mirror of
https://github.com/zeromq/libzmq.git
synced 2025-03-09 15:26:04 +00:00
Problem: security tests block on zmq_send
The expect_bounce_fail () helper assumed that messages could always be sent. However in some cases zmq_send() blocks, due to there not being any outgoing pipe. This changed in 77f5f7, where previously there would be a pipe that kept trying to reconnect forever. Solution: use a send timeout and check for EAGAIN if sending failed.
This commit is contained in:
parent
a1fbd97330
commit
11175a33f1
@ -130,12 +130,13 @@ expect_bounce_fail (void *server, void *client)
|
||||
assert (zmq_errno () == EAGAIN);
|
||||
|
||||
// Send message from server to client to test other direction
|
||||
// If connection failed, send may block, without a timeout
|
||||
rc = zmq_setsockopt (server, ZMQ_SNDTIMEO, &timeout, sizeof (int));
|
||||
assert (rc == 0);
|
||||
rc = zmq_send (server, content, 32, ZMQ_SNDMORE);
|
||||
assert ((rc == 32) || ((rc == -1) && (errno == EAGAIN)));
|
||||
assert (rc == 32 || (rc == -1 && zmq_errno () == EAGAIN));
|
||||
rc = zmq_send (server, content, 32, 0);
|
||||
assert ((rc == 32) || ((rc == -1) && (errno == EAGAIN)));
|
||||
assert (rc == 32 || (rc == -1 && zmq_errno () == EAGAIN));
|
||||
|
||||
// Receive message at client side (should not succeed)
|
||||
rc = zmq_setsockopt (client, ZMQ_RCVTIMEO, &timeout, sizeof (int));
|
||||
|
Loading…
x
Reference in New Issue
Block a user