aboutsummaryrefslogtreecommitdiffstats
path: root/src/inspsocket.cpp
diff options
context:
space:
mode:
authorGravatar w00t2008-04-01 19:38:11 +0000
committerGravatar w00t2008-04-01 19:38:11 +0000
commitfda193662c8bad2d8641ad1952bf41ad93bdad4f (patch)
treebdd05c3bf6b376f0433f1e7e7a9b42b5862d6771 /src/inspsocket.cpp
parentPatch by brain; fix crash when no parameters are given when introducing a rem... (diff)
Backport r9247: server buffering improvements (don't constantly flush write buffer) QA: this needs testing of server linking and SSL, and SSL server linking
git-svn-id: http://svn.inspircd.org/repository/branches/1_1_stable@9248 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/inspsocket.cpp')
-rw-r--r--src/inspsocket.cpp19
1 files changed, 13 insertions, 6 deletions
diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp
index a5ca4e388..2397f4444 100644
--- a/src/inspsocket.cpp
+++ b/src/inspsocket.cpp
@@ -439,17 +439,24 @@ void InspSocket::MarkAsClosed()
{
}
-// There are two possible outcomes to this function.
-// It will either write all of the data, or an undefined amount.
-// If an undefined amount is written the connection has failed
-// and should be aborted.
-int InspSocket::Write(const std::string &data)
+ /*
+ * This function formerly tried to flush write buffer each call.
+ * While admirable in attempting to get the data out to wherever
+ * it is going, on a full socket, it's just going to syscall write() and
+ * EAGAIN constantly, instead of waiting in the SE to know if it can write
+ * which will chew a bit of CPU.
+ *
+ * So, now this function returns void (take note) and just adds to the sendq.
+ *
+ * It'll get written at a determinate point when the socketengine tells us it can write.
+ * -- w00t (april 1, 2008)
+ */
+void InspSocket::Write(const std::string &data)
{
/* Try and append the data to the back of the queue, and send it on its way
*/
outbuffer.push_back(data);
this->Instance->SE->WantWrite(this);
- return (!this->FlushWriteBuffer());
}
bool InspSocket::FlushWriteBuffer()