diff options
author | Adam <Adam@anope.org> | 2010-12-10 01:18:59 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2010-12-12 19:37:03 -0500 |
commit | ad5da2a98867da93328b3caaced1eb470ab14dd0 (patch) | |
tree | 1812640e20cc538ac89d7a6e57ac890ccf09da1b /src/sockets.cpp | |
parent | 6ab7cf968938fc070ee01f314834ad1e66d1de09 (diff) |
Handle not being able to completely flush our write buffer correctly
Diffstat (limited to 'src/sockets.cpp')
-rw-r--r-- | src/sockets.cpp | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/src/sockets.cpp b/src/sockets.cpp index 0eb7733cf..e980056f5 100644 --- a/src/sockets.cpp +++ b/src/sockets.cpp @@ -509,15 +509,12 @@ 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(); + this->WriteBuffer = this->WriteBuffer.substr(count); SocketEngine->ClearWritable(this); return true; |