summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@fastmq.commkdir>2009-09-16 09:50:39 +0200
committerMartin Sustrik <sustrik@fastmq.commkdir>2009-09-16 09:50:39 +0200
commitbce2e60bbb3b7f799a532d9b8f2e171c570b9fea (patch)
tree696c4df0b7719f0762eda209c6f4265dca3e05fe
parent98b8e9b54dd8c67006422106b478a3a6eab07869 (diff)
more errors from send & recv handled decently on windows
-rw-r--r--src/tcp_socket.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/tcp_socket.cpp b/src/tcp_socket.cpp
index 7e68e7d..d3de66f 100644
--- a/src/tcp_socket.cpp
+++ b/src/tcp_socket.cpp
@@ -65,7 +65,13 @@ int zmq::tcp_socket_t::write (const void *data, int size)
return 0;
// Signalise peer failure.
- if (nbytes == SOCKET_ERROR && WSAGetLastError () == WSAECONNRESET)
+ if (nbytes == -1 && (
+ WSAGetLastError () == WSAENETDOWN ||
+ WSAGetLastError () == WSAENETRESET ||
+ WSAGetLastError () == WSAEHOSTUNREACH ||
+ WSAGetLastError () == WSAECONNABORTED ||
+ WSAGetLastError () == WSAETIMEDOUT ||
+ WSAGetLastError () == WSAECONNRESET))
return -1;
wsa_assert (nbytes != SOCKET_ERROR);
@@ -84,6 +90,10 @@ int zmq::tcp_socket_t::read (void *data, int size)
// Connection failure.
if (nbytes == -1 && (
+ WSAGetLastError () == WSAENETDOWN ||
+ WSAGetLastError () == WSAENETRESET ||
+ WSAGetLastError () == WSAECONNABORTED ||
+ WSAGetLastError () == WSAETIMEDOUT ||
WSAGetLastError () == WSAECONNRESET ||
WSAGetLastError () == WSAECONNREFUSED ||
WSAGetLastError () == WSAENOTCONN))