diff options
author | Adam <Adam@anope.org> | 2014-02-05 15:26:03 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2014-02-05 15:26:03 -0500 |
commit | 66cc965fd736a7785247a6c058c4bfacfe5ea02f (patch) | |
tree | 93f38cc6dc1d2e187d027a54b392d168b7626e1d /src/socket_transport.cpp | |
parent | 2440514a7b53a43aa2efe8a0ef45f79d7a3710a8 (diff) |
Ignore nonblocking errnors on socket operations
Diffstat (limited to 'src/socket_transport.cpp')
-rw-r--r-- | src/socket_transport.cpp | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/socket_transport.cpp b/src/socket_transport.cpp index 72b712232..26653e55f 100644 --- a/src/socket_transport.cpp +++ b/src/socket_transport.cpp @@ -29,8 +29,10 @@ bool BufferedSocket::ProcessRead() this->recv_len = 0; int len = this->io->Recv(this, tbuffer, sizeof(tbuffer) - 1); - if (len <= 0) + if (len == 0) return false; + if (len < 0) + return SocketEngine::IgnoreErrno(); tbuffer[len] = 0; this->read_buffer.append(tbuffer); @@ -42,8 +44,11 @@ bool BufferedSocket::ProcessRead() bool BufferedSocket::ProcessWrite() { int count = this->io->Send(this, this->write_buffer); - if (count <= -1) + if (count == 0) return false; + if (count < 0) + return SocketEngine::IgnoreErrno(); + this->write_buffer = this->write_buffer.substr(count); if (this->write_buffer.empty()) SocketEngine::Change(this, false, SF_WRITABLE); |