aboutsummaryrefslogtreecommitdiff
path: root/src/inspsocket.cpp
diff options
context:
space:
mode:
authorGravatar attilamolnar2013-06-19 21:53:12 +0200
committerGravatar attilamolnar2013-07-07 23:10:45 +0200
commit7dd381f568938971e9c69a074def5da058d5c242 (patch)
tree190f6f0aae5c46e2220ab886aafdeb546575d94f /src/inspsocket.cpp
parentMerge pull request #563 from ElementalAlchemist/patch-1 (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.cpp12
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();