Merge pull request #753 from pijyoi/master

handle bind error in make_fdpair() win32 codepath
This commit is contained in:
Ian Barber 2013-11-11 09:13:09 -08:00
commit e3ddda7a1f

View File

@ -348,7 +348,15 @@ int zmq::signaler_t::make_fdpair (fd_t *r_, fd_t *w_)
addr.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
addr.sin_port = htons (signaler_port);
rc = bind (listener, (const struct sockaddr*) &addr, sizeof (addr));
wsa_assert (rc != SOCKET_ERROR);
if (rc == SOCKET_ERROR) {
int saved_errno = WSAGetLastError ();
closesocket (listener);
SetEvent (sync);
CloseHandle (sync);
// Set errno from saved value
errno = wsa_error_to_errno (saved_errno);
return -1;
}
// Listen for incomming connections.
rc = listen (listener, 1);