Commit e0534643 authored by Martin Hurton's avatar Martin Hurton

Simplify error handling in tcp_connecter

parent 13ef1e4f
...@@ -218,20 +218,17 @@ int zmq::tcp_connecter_t::open () ...@@ -218,20 +218,17 @@ int zmq::tcp_connecter_t::open ()
if (rc == 0) if (rc == 0)
return 0; return 0;
// Translate other error codes indicating asynchronous connect has been // Translate error codes indicating asynchronous connect has been
// launched to a uniform EINPROGRESS. // launched to a uniform EINPROGRESS.
#ifdef ZMQ_HAVE_WINDOWS #ifdef ZMQ_HAVE_WINDOWS
if (rc == SOCKET_ERROR && (WSAGetLastError () == WSAEINPROGRESS || const int error_code = WSAGetLastError ();
WSAGetLastError () == WSAEWOULDBLOCK)) { if (error_code == WSAEINPROGRESS || error_code == WSAEWOULDBLOCK)
errno = EINPROGRESS; errno = EINPROGRESS;
return -1; else
} errno = wsa_error_to_errno (error_code);
errno = wsa_error_to_errno (WSAGetLastError ());
#else #else
if (rc == -1 && errno == EINTR) { if (errno == EINTR)
errno = EINPROGRESS; errno = EINPROGRESS;
return -1;
}
#endif #endif
return -1; return -1;
} }
......
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