summaryrefslogtreecommitdiff
path: root/src/inspsocket.cpp
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-21 21:39:52 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-09-21 21:39:52 +0000
commit9f2e1f901930d3646db5f3c21180f02f2f9ce41f (patch)
tree70677e02fe8465036cd916cc5113490ed3a5e659 /src/inspsocket.cpp
parentcb1a0e5612d04a8bd8d5b0fac7143ef7eb865dfd (diff)
Improve speed of SSL sendq processing
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11756 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/inspsocket.cpp')
-rw-r--r--src/inspsocket.cpp16
1 files changed, 16 insertions, 0 deletions
diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp
index 1f0aa5629..907acea67 100644
--- a/src/inspsocket.cpp
+++ b/src/inspsocket.cpp
@@ -204,6 +204,22 @@ void StreamSocket::DoWrite()
int rv = -1;
try
{
+ if (sendq.size() > 1 && sendq[0].length() < 1024)
+ {
+ // Avoid multiple repeated SSL encryption invocations
+ // This adds a single copy of the queue, but avoids
+ // much more overhead in terms of system calls invoked
+ // by the IOHook.
+ //
+ // 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);
+ }
while (!sendq.empty())
{
std::string& front = sendq.front();