0
0
mirror of https://github.com/zeromq/libzmq.git synced 2025-01-06 11:22:55 +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) 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;
} }