Commit 326d3a57 by xiongziliang

适配网络库

parent d310978c
......@@ -396,8 +396,6 @@ inline HttpSession::HttpCode HttpSession::Handle_Req_GET() {
});
GET_CONFIG_AND_REGISTER(uint32_t,sendBufSize,Config::Http::kSendBufSize);
//缓存大小为两个包,太大可能导致发送时间太长从而超时
_sock->setSendPktSize(2);
weak_ptr<HttpSession> weakSelf = dynamic_pointer_cast<HttpSession>(shared_from_this());
auto onFlush = [pFilePtr,bClose,weakSelf,piLeft]() {
TimeTicker();
......@@ -424,7 +422,6 @@ inline HttpSession::HttpCode HttpSession::Handle_Req_GET() {
//InfoL << "send complete!" << iRead << " " << iReq << " " << *piLeft;
if(iRead>0) {
sendBuf->setSize(iRead);
strongSelf->_sock->setSendPktSize(3);//强制写入socket缓存
strongSelf->send(sendBuf);
}
if(bClose) {
......@@ -436,20 +433,20 @@ inline HttpSession::HttpCode HttpSession::Handle_Req_GET() {
sendBuf->setSize(iRead);
int iSent = strongSelf->send(sendBuf);
if(iSent == -1) {
//send error
//InfoL << "send error";
return false;
}
if(iSent < iRead) {
//send wait
//InfoL << "send wait";
//数据回滚
fseek(pFilePtr.get(), -iRead, SEEK_CUR);
*piLeft += iRead;
return true;
}
if(strongSelf->isSocketBusy()){
//套接字忙,那么停止继续写
return true;
}
//send success
//InfoL << "send success";
}
return false;
};
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论