Commit ba1515fe authored by Pieter Hintjens's avatar Pieter Hintjens

Problem: asserts if EINVAL recieved on read/write

This causes assertion failures after network reconnects.

Solution: allow EINVAL as a possible condition after read/write.

Fixes #829
Fixes #1399

Patch provided by Michele Dionisio @mdionisio, thanks :)
parent f38c11c0
...@@ -218,7 +218,6 @@ void zmq::tune_tcp_retransmit_timeout (fd_t sockfd_, int timeout_) ...@@ -218,7 +218,6 @@ void zmq::tune_tcp_retransmit_timeout (fd_t sockfd_, int timeout_)
&& errno != EBADF && errno != EBADF
&& errno != EDESTADDRREQ && errno != EDESTADDRREQ
&& errno != EFAULT && errno != EFAULT
&& errno != EINVAL
&& errno != EISCONN && errno != EISCONN
&& errno != EMSGSIZE && errno != EMSGSIZE
&& errno != ENOMEM && errno != ENOMEM
...@@ -240,21 +239,21 @@ int zmq::tcp_read (fd_t s_, void *data_, size_t size_) ...@@ -240,21 +239,21 @@ int zmq::tcp_read (fd_t s_, void *data_, size_t size_)
// If not a single byte can be read from the socket in non-blocking mode // If not a single byte can be read from the socket in non-blocking mode
// we'll get an error (this may happen during the speculative read). // we'll get an error (this may happen during the speculative read).
if (rc == SOCKET_ERROR) { if (rc == SOCKET_ERROR) {
const int last_error = WSAGetLastError(); const int last_error = WSAGetLastError();
if (last_error == WSAEWOULDBLOCK) { if (last_error == WSAEWOULDBLOCK) {
errno = EAGAIN; errno = EAGAIN;
} }
else { else {
wsa_assert (last_error == WSAENETDOWN || wsa_assert (last_error == WSAENETDOWN ||
last_error == WSAENETRESET || last_error == WSAENETRESET ||
last_error == WSAECONNABORTED || last_error == WSAECONNABORTED ||
last_error == WSAETIMEDOUT || last_error == WSAETIMEDOUT ||
last_error == WSAECONNRESET || last_error == WSAECONNRESET ||
last_error == WSAECONNREFUSED || last_error == WSAECONNREFUSED ||
last_error == WSAENOTCONN); last_error == WSAENOTCONN);
errno = wsa_error_to_errno (last_error); errno = wsa_error_to_errno (last_error);
} }
} }
return rc == SOCKET_ERROR ? -1 : rc; return rc == SOCKET_ERROR ? -1 : rc;
...@@ -269,7 +268,6 @@ int zmq::tcp_read (fd_t s_, void *data_, size_t size_) ...@@ -269,7 +268,6 @@ int zmq::tcp_read (fd_t s_, void *data_, size_t size_)
if (rc == -1) { if (rc == -1) {
errno_assert (errno != EBADF errno_assert (errno != EBADF
&& errno != EFAULT && errno != EFAULT
&& errno != EINVAL
&& errno != ENOMEM && errno != ENOMEM
&& errno != ENOTSOCK); && errno != ENOTSOCK);
if (errno == EWOULDBLOCK || errno == EINTR) if (errno == EWOULDBLOCK || errno == EINTR)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment