diff options
author | Martin Lucina <martin@lucina.net> | 2012-01-23 09:00:29 +0100 |
---|---|---|
committer | Martin Lucina <martin@lucina.net> | 2012-01-23 09:00:29 +0100 |
commit | ba0336b4d129a9e261c95276f89640b3459176bf (patch) | |
tree | a488f7efb61a6950a462815062c3b0f007f40ff5 /src/tcp_socket.cpp | |
parent | c3363afa881b46f3df8a6b72ed15cfbac18f4713 (diff) | |
parent | 4016b657973bba87caf75168ba70aaa85d556487 (diff) |
Merge commit 'upstream/2.1.11'
Diffstat (limited to 'src/tcp_socket.cpp')
-rw-r--r-- | src/tcp_socket.cpp | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/tcp_socket.cpp b/src/tcp_socket.cpp index 07159d8..775a7a6 100644 --- a/src/tcp_socket.cpp +++ b/src/tcp_socket.cpp @@ -79,7 +79,7 @@ int zmq::tcp_socket_t::write (const void *data, int size) // we'll get an error (this may happen during the speculative write). if (nbytes == SOCKET_ERROR && WSAGetLastError () == WSAEWOULDBLOCK) return 0; - + // Signalise peer failure. if (nbytes == -1 && ( WSAGetLastError () == WSAENETDOWN || @@ -119,7 +119,7 @@ int zmq::tcp_socket_t::read (void *data, int size) // Orderly shutdown by the other peer. if (nbytes == 0) - return -1; + return -1; return (size_t) nbytes; } @@ -200,9 +200,6 @@ int zmq::tcp_socket_t::write (const void *data, int size) if (nbytes == -1 && (errno == ECONNRESET || errno == EPIPE)) return -1; - if (nbytes == 1) - fprintf (stderr, "E: unhandled error on send: %d/%s\n", - errno, strerror (errno)); errno_assert (nbytes != -1); return (size_t) nbytes; } @@ -214,18 +211,21 @@ int zmq::tcp_socket_t::read (void *data, int size) // Several errors are OK. When speculative read is being done we may not // be able to read a single byte to the socket. Also, SIGSTOP issued // by a debugging tool can result in EINTR error. - if (nbytes == -1 && (errno == EAGAIN || errno == EWOULDBLOCK || - errno == EINTR)) + if (nbytes == -1 + && (errno == EAGAIN + || errno == EWOULDBLOCK + || errno == EINTR)) return 0; - // Signalise peer failure. - if (nbytes == -1 && (errno == ECONNRESET || errno == ECONNREFUSED || - errno == ETIMEDOUT || errno == EHOSTUNREACH)) + // Signal peer failure. + if (nbytes == -1 + && (errno == ECONNRESET + || errno == ECONNREFUSED + || errno == ETIMEDOUT + || errno == EHOSTUNREACH + || errno == ENOTCONN)) return -1; - if (nbytes == 1) - fprintf (stderr, "E: unhandled error on recv: %d/%s\n", - errno, strerror (errno)); errno_assert (nbytes != -1); // Orderly shutdown by the other peer. |