0
0
mirror of https://github.com/zeromq/libzmq.git synced 2025-01-04 13:05:41 +08:00

Simplify error handling in tcp_connecter

This commit is contained in:
Martin Hurton 2012-05-27 23:35:32 +02:00
parent 13ef1e4f26
commit e0534643fa

View File

@ -218,20 +218,17 @@ int zmq::tcp_connecter_t::open ()
if (rc == 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.
#ifdef ZMQ_HAVE_WINDOWS
if (rc == SOCKET_ERROR && (WSAGetLastError () == WSAEINPROGRESS ||
WSAGetLastError () == WSAEWOULDBLOCK)) {
const int error_code = WSAGetLastError ();
if (error_code == WSAEINPROGRESS || error_code == WSAEWOULDBLOCK)
errno = EINPROGRESS;
return -1;
}
errno = wsa_error_to_errno (WSAGetLastError ());
else
errno = wsa_error_to_errno (error_code);
#else
if (rc == -1 && errno == EINTR) {
if (errno == EINTR)
errno = EINPROGRESS;
return -1;
}
#endif
return -1;
}