diff options
author | Attila Molnar <attilamolnar@hush.com> | 2014-02-18 03:28:02 +0100 |
---|---|---|
committer | Attila Molnar <attilamolnar@hush.com> | 2014-02-18 03:28:02 +0100 |
commit | 3883716883fbcaade9b8f26af8451bf4b6dac66b (patch) | |
tree | 93785cca887dbea0c0f7200e87eae9f98a47dd0b | |
parent | 5beea4eb7ebb8938cc2ef73cbb16e215897d0708 (diff) |
Turn BinarySocket::Write() into a no-op when called with l == 0
-rw-r--r-- | include/sockets.h | 2 | ||||
-rw-r--r-- | src/socket_transport.cpp | 2 |
2 files changed, 3 insertions, 1 deletions
diff --git a/include/sockets.h b/include/sockets.h index 744f1a23e..0dfa5d9d0 100644 --- a/include/sockets.h +++ b/include/sockets.h @@ -347,7 +347,7 @@ class CoreExport BinarySocket : public virtual Socket /** Write data to the socket * @param buffer The data to write - * @param l The length of the data + * @param l The length of the data; if 0 then this function returns without doing anything */ virtual void Write(const char *buffer, size_t l); void Write(const char *message, ...); diff --git a/src/socket_transport.cpp b/src/socket_transport.cpp index 6293ea385..1476d0662 100644 --- a/src/socket_transport.cpp +++ b/src/socket_transport.cpp @@ -167,6 +167,8 @@ bool BinarySocket::ProcessWrite() void BinarySocket::Write(const char *buffer, size_t l) { + if (l == 0) + return; this->write_buffer.push_back(new DataBlock(buffer, l)); SocketEngine::Change(this, true, SF_WRITABLE); } |