尝试使用sendfile优化http文件服务器 (#1411)

This commit is contained in:
夏楚
2022-02-04 23:02:19 +08:00
committed by GitHub
parent c72cf4cbcc
commit d13e31c21b
3 changed files with 30 additions and 0 deletions

View File

@@ -594,6 +594,11 @@ void HttpSession::sendResponse(int code,
return;
}
if (!body->sendFile(getSock()->rawFD())) {
//支持sendfile优化
return;
}
GET_CONFIG(uint32_t, sendBufSize, Http::kSendBufSize);
if(body->remainSize() > sendBufSize){
//文件下载提升发送性能