summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-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();