0
0
mirror of https://github.com/zeromq/libzmq.git synced 2025-01-04 04:55:27 +08:00

Problem: Assertion failed in zmq::signaler_t::send

Solution: Change to the way it does below on non-Windows platforms, retry when send returns -1.
This commit is contained in:
nexcvon 2017-03-03 19:00:58 +08:00 committed by GitHub
parent 07d904a2f8
commit bcf75777c8

View File

@ -187,9 +187,13 @@ void zmq::signaler_t::send ()
errno_assert (sz == sizeof (inc));
#elif defined ZMQ_HAVE_WINDOWS
unsigned char dummy = 0;
int nbytes = ::send (w, (char *) &dummy, sizeof (dummy), 0);
wsa_assert (nbytes != SOCKET_ERROR);
zmq_assert (nbytes == sizeof (dummy));
while (true) {
int nbytes = ::send (w, (char*) &dummy, sizeof (dummy), 0);
if (unlikely (nbytes == SOCKET_ERROR))
continue;
zmq_assert (nbytes == sizeof (dummy));
break;
}
#else
unsigned char dummy = 0;
while (true) {