Problem: inconsistent error handling and unnecessary code duplication

Solution: make error handling consistent and use retired_fd to remove code duplication
This commit is contained in:
Simon Giesecke
2018-05-23 10:10:32 +02:00
parent d02ba13576
commit c432aada84
4 changed files with 18 additions and 36 deletions

View File

@@ -279,15 +279,9 @@ int zmq::tcp_connecter_t::open ()
s = open_socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
}
#ifdef ZMQ_HAVE_WINDOWS
if (s == INVALID_SOCKET) {
errno = wsa_error_to_errno (WSAGetLastError ());
if (s == retired_fd) {
return -1;
}
#else
if (s == -1)
return -1;
#endif
// On some systems, IPv4 mapping in IPv6 sockets is disabled by default.
// Switch it on in such cases.