diff options
author | Adam <Adam@anope.org> | 2010-12-24 20:02:25 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2010-12-24 20:02:25 -0500 |
commit | 479fc1ce3fa909dd326263cd2639838a0a70bd08 (patch) | |
tree | 371c738ab61e0dc148f6e033f6d4fa1db6a862b1 | |
parent | 667419a4607f55233b706da1d6d9f6ffd4d3495e (diff) |
Handle not being able to completely flush our write buffer correctly
-rw-r--r-- | src/sockets.cpp | 14 |
1 files changed, 6 insertions, 8 deletions
diff --git a/src/sockets.cpp b/src/sockets.cpp index 9e32f85eb..54fdfc03b 100644 --- a/src/sockets.cpp +++ b/src/sockets.cpp @@ -435,16 +435,14 @@ bool BufferedSocket::ProcessRead() */ bool BufferedSocket::ProcessWrite() { - if (WriteBuffer.empty()) - { + if (this->WriteBuffer.empty()) return true; - } - if (this->IO->Send(this, WriteBuffer) == -1) - { + int count = this->IO->Send(this, this->WriteBuffer); + if (count == -1) return false; - } - WriteBuffer.clear(); - SocketEngine->ClearWritable(this); + this->WriteBuffer = this->WriteBuffer.substr(count); + if (this->WriteBuffer.empty()) + SocketEngine->ClearWritable(this); return true; } |