From 7dd381f568938971e9c69a074def5da058d5c242 Mon Sep 17 00:00:00 2001 From: attilamolnar Date: Wed, 19 Jun 2013 21:53:12 +0200 Subject: Do not send too much data over SSL in one go Some clients fail to read it entirely and the remaining data stays in their read buffer until new data arrives --- src/inspsocket.cpp | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp index d78ace318..410f928d9 100644 --- a/src/inspsocket.cpp +++ b/src/inspsocket.cpp @@ -248,11 +248,13 @@ void StreamSocket::DoWrite() // The length limit of 1024 is to prevent merging strings // more than once when writes begin to block. std::string tmp; - tmp.reserve(sendq_len); - for(unsigned int i=0; i < sendq.size(); i++) - tmp.append(sendq[i]); - sendq.clear(); - sendq.push_back(tmp); + tmp.reserve(1280); + while (!sendq.empty() && tmp.length() < 1024) + { + tmp.append(sendq.front()); + sendq.pop_front(); + } + sendq.push_front(tmp); } std::string& front = sendq.front(); int itemlen = front.length(); -- cgit v1.2.3