mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2024-11-26 12:37:09 +08:00
仅http协议开启sendfile优化
This commit is contained in:
parent
d13e31c21b
commit
4505f8ff4f
@ -594,20 +594,20 @@ void HttpSession::sendResponse(int code,
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!body->sendFile(getSock()->rawFD())) {
|
if (typeid(*this) == typeid(HttpSession) && !body->sendFile(getSock()->rawFD())) {
|
||||||
//支持sendfile优化
|
//http支持sendfile优化
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
GET_CONFIG(uint32_t, sendBufSize, Http::kSendBufSize);
|
GET_CONFIG(uint32_t, sendBufSize, Http::kSendBufSize);
|
||||||
if(body->remainSize() > sendBufSize){
|
if (body->remainSize() > sendBufSize) {
|
||||||
//文件下载提升发送性能
|
//文件下载提升发送性能
|
||||||
setSocketFlags();
|
setSocketFlags();
|
||||||
}
|
}
|
||||||
|
|
||||||
//发送http body
|
//发送http body
|
||||||
AsyncSenderData::Ptr data = std::make_shared<AsyncSenderData>(shared_from_this(),body,bClose);
|
AsyncSenderData::Ptr data = std::make_shared<AsyncSenderData>(shared_from_this(), body, bClose);
|
||||||
getSock()->setOnFlush([data](){
|
getSock()->setOnFlush([data]() {
|
||||||
return AsyncSender::onSocketFlushed(data);
|
return AsyncSender::onSocketFlushed(data);
|
||||||
});
|
});
|
||||||
AsyncSender::onSocketFlushed(data);
|
AsyncSender::onSocketFlushed(data);
|
||||||
|
Loading…
Reference in New Issue
Block a user