mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-13 18:55:10 +01:00
Problem: shutdown asserts if WSASTARUP wasn't done previously
This is a silly assertion that causes problems if libzmq.dll is called in some esoteric ways. Solution: if the shutdown code detects WSANOTINITIALISED, then exit silently. Fixes #1377 Fixes #1144
This commit is contained in:
parent
0673cd4e69
commit
594e3dcceb
@ -132,11 +132,14 @@ zmq::signaler_t::~signaler_t ()
|
||||
const struct linger so_linger = { 1, 0 };
|
||||
int rc = setsockopt (w, SOL_SOCKET, SO_LINGER,
|
||||
(const char *) &so_linger, sizeof so_linger);
|
||||
wsa_assert (rc != SOCKET_ERROR);
|
||||
rc = closesocket (w);
|
||||
wsa_assert (rc != SOCKET_ERROR);
|
||||
rc = closesocket (r);
|
||||
wsa_assert (rc != SOCKET_ERROR);
|
||||
// Only check shutdown if WSASTARTUP was previously done
|
||||
if (rc == 0 || WSAGetLastError () != WSANOTINITIALISED) {
|
||||
wsa_assert (rc != SOCKET_ERROR);
|
||||
rc = closesocket (w);
|
||||
wsa_assert (rc != SOCKET_ERROR);
|
||||
rc = closesocket (r);
|
||||
wsa_assert (rc != SOCKET_ERROR);
|
||||
}
|
||||
#else
|
||||
int rc = close_wait_ms (w);
|
||||
errno_assert (rc == 0);
|
||||
|
Loading…
Reference in New Issue
Block a user