diff options
author | attilamolnar <attilamolnar@hush.com> | 2013-06-19 21:53:12 +0200 |
---|---|---|
committer | attilamolnar <attilamolnar@hush.com> | 2013-07-07 23:10:45 +0200 |
commit | 7dd381f568938971e9c69a074def5da058d5c242 (patch) | |
tree | 190f6f0aae5c46e2220ab886aafdeb546575d94f /src/inspsocket.cpp | |
parent | 71d64de8f0b77d0025a7a48f72d1b63d96fb4bdc (diff) |
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
Diffstat (limited to 'src/inspsocket.cpp')
-rw-r--r-- | src/inspsocket.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
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(); |