diff options
-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; } |