mirror of
https://github.com/zeromq/libzmq.git
synced 2025-01-15 18:38:00 +08:00
commit
0836de2f2e
2
NEWS
2
NEWS
@ -1,7 +1,9 @@
|
|||||||
0MQ version 3.2.4 stable, released on 2013/xx/xx
|
0MQ version 3.2.4 stable, released on 2013/xx/xx
|
||||||
================================================
|
================================================
|
||||||
|
|
||||||
|
* LIBZMQ-532 (Windows) critical section not released on error
|
||||||
* LIBZMQ-456 ZMQ_XPUB_VERBOSE does not propagate in a tree of XPUB/XSUB devices
|
* LIBZMQ-456 ZMQ_XPUB_VERBOSE does not propagate in a tree of XPUB/XSUB devices
|
||||||
|
* LIBZMQ-84 (Windows) Assertion failed: Address already in use at signaler.cpp:80
|
||||||
|
|
||||||
|
|
||||||
0MQ version 3.2.3 stable, released on 2013/05/02
|
0MQ version 3.2.3 stable, released on 2013/05/02
|
||||||
|
@ -95,7 +95,11 @@ zmq::signaler_t::~signaler_t ()
|
|||||||
int rc = close (r);
|
int rc = close (r);
|
||||||
errno_assert (rc == 0);
|
errno_assert (rc == 0);
|
||||||
#elif defined ZMQ_HAVE_WINDOWS
|
#elif defined ZMQ_HAVE_WINDOWS
|
||||||
int rc = closesocket (w);
|
struct linger so_linger = { 1, 0 };
|
||||||
|
int rc = setsockopt (w, SOL_SOCKET, SO_LINGER,
|
||||||
|
(char *)&so_linger, sizeof (so_linger));
|
||||||
|
wsa_assert (rc != SOCKET_ERROR);
|
||||||
|
rc = closesocket (w);
|
||||||
wsa_assert (rc != SOCKET_ERROR);
|
wsa_assert (rc != SOCKET_ERROR);
|
||||||
rc = closesocket (r);
|
rc = closesocket (r);
|
||||||
wsa_assert (rc != SOCKET_ERROR);
|
wsa_assert (rc != SOCKET_ERROR);
|
||||||
@ -279,7 +283,7 @@ int zmq::signaler_t::make_fdpair (fd_t *r_, fd_t *w_)
|
|||||||
(char *)&tcp_nodelay, sizeof (tcp_nodelay));
|
(char *)&tcp_nodelay, sizeof (tcp_nodelay));
|
||||||
wsa_assert (rc != SOCKET_ERROR);
|
wsa_assert (rc != SOCKET_ERROR);
|
||||||
|
|
||||||
// Bind listening socket to any free local port.
|
// Bind listening socket to signaler port.
|
||||||
struct sockaddr_in addr;
|
struct sockaddr_in addr;
|
||||||
memset (&addr, 0, sizeof (addr));
|
memset (&addr, 0, sizeof (addr));
|
||||||
addr.sin_family = AF_INET;
|
addr.sin_family = AF_INET;
|
||||||
@ -307,15 +311,19 @@ int zmq::signaler_t::make_fdpair (fd_t *r_, fd_t *w_)
|
|||||||
|
|
||||||
// Connect writer to the listener.
|
// Connect writer to the listener.
|
||||||
rc = connect (*w_, (struct sockaddr*) &addr, sizeof (addr));
|
rc = connect (*w_, (struct sockaddr*) &addr, sizeof (addr));
|
||||||
wsa_assert (rc != SOCKET_ERROR);
|
|
||||||
|
|
||||||
|
// Save errno if connection fails
|
||||||
|
int conn_errno = 0;
|
||||||
|
if (rc == SOCKET_ERROR) {
|
||||||
|
conn_errno = WSAGetLastError ();
|
||||||
|
} else {
|
||||||
// Accept connection from writer.
|
// Accept connection from writer.
|
||||||
*r_ = accept (listener, NULL, NULL);
|
*r_ = accept (listener, NULL, NULL);
|
||||||
wsa_assert (*r_ != INVALID_SOCKET);
|
|
||||||
|
|
||||||
// On Windows, preventing sockets to be inherited by child processes.
|
if (*r_ == INVALID_SOCKET) {
|
||||||
brc = SetHandleInformation ((HANDLE) *r_, HANDLE_FLAG_INHERIT, 0);
|
conn_errno = WSAGetLastError ();
|
||||||
win_assert (brc);
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// We don't need the listening socket anymore. Close it.
|
// We don't need the listening socket anymore. Close it.
|
||||||
rc = closesocket (listener);
|
rc = closesocket (listener);
|
||||||
@ -329,7 +337,29 @@ int zmq::signaler_t::make_fdpair (fd_t *r_, fd_t *w_)
|
|||||||
brc = CloseHandle (sync);
|
brc = CloseHandle (sync);
|
||||||
win_assert (brc != 0);
|
win_assert (brc != 0);
|
||||||
|
|
||||||
|
if (*r_ != INVALID_SOCKET) {
|
||||||
|
// On Windows, preventing sockets to be inherited by child processes.
|
||||||
|
brc = SetHandleInformation ((HANDLE) *r_, HANDLE_FLAG_INHERIT, 0);
|
||||||
|
win_assert (brc);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
} else {
|
||||||
|
// Cleanup writer if connection failed
|
||||||
|
rc = closesocket (*w_);
|
||||||
|
wsa_assert (rc != SOCKET_ERROR);
|
||||||
|
|
||||||
|
*w_ = INVALID_SOCKET;
|
||||||
|
|
||||||
|
// Set errno from saved value
|
||||||
|
errno = wsa_error_to_errno (conn_errno);
|
||||||
|
|
||||||
|
// Ideally, we would return errno to the caller signaler_t()
|
||||||
|
// Unfortunately, it uses errno_assert() which gives "Unknown error"
|
||||||
|
// We might as well assert here and print the actual error message
|
||||||
|
wsa_assert_no (conn_errno);
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
#elif defined ZMQ_HAVE_OPENVMS
|
#elif defined ZMQ_HAVE_OPENVMS
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user