From 326d3a57c66b207b6f9f4aca67dadc28d981ecf5 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Wed, 14 Mar 2018 14:51:54 +0800 Subject: [PATCH] =?UTF-8?q?=E9=80=82=E9=85=8D=E7=BD=91=E7=BB=9C=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Http/HttpSession.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/src/Http/HttpSession.cpp b/src/Http/HttpSession.cpp index 984ec9dd..88aef575 100644 --- a/src/Http/HttpSession.cpp +++ b/src/Http/HttpSession.cpp @@ -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 weakSelf = dynamic_pointer_cast(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; };