Commit 155feccb authored by Pieter Hintjens's avatar Pieter Hintjens

Merge pull request #1047 from mrvn/pull-testutil-expect_bounce_fail-send-timeout

Add a send timeout in expect_bounce_fail()
parents 11357df0 0ebf94e4
......@@ -112,15 +112,17 @@ expect_bounce_fail (void *server, void *client)
{
const char *content = "12345678ABCDEFGH12345678abcdefgh";
char buffer [32];
int timeout = 150;
// Send message from client to server
int rc = zmq_send (client, content, 32, ZMQ_SNDMORE);
assert (rc == 32);
int rc = zmq_setsockopt (client, ZMQ_SNDTIMEO, &timeout, sizeof (int));
assert (rc == 0);
rc = zmq_send (client, content, 32, ZMQ_SNDMORE);
assert ((rc == 32) || ((rc == -1) && (errno == EAGAIN)));
rc = zmq_send (client, content, 32, 0);
assert (rc == 32);
assert ((rc == 32) || ((rc == -1) && (errno == EAGAIN)));
// Receive message at server side (should not succeed)
int timeout = 150;
rc = zmq_setsockopt (server, ZMQ_RCVTIMEO, &timeout, sizeof (int));
assert (rc == 0);
rc = zmq_recv (server, buffer, 32, 0);
......@@ -128,10 +130,12 @@ expect_bounce_fail (void *server, void *client)
assert (zmq_errno () == EAGAIN);
// Send message from server to client to test other direction
rc = zmq_setsockopt (server, ZMQ_SNDTIMEO, &timeout, sizeof (int));
assert (rc == 0);
rc = zmq_send (server, content, 32, ZMQ_SNDMORE);
assert (rc == 32);
assert ((rc == 32) || ((rc == -1) && (errno == EAGAIN)));
rc = zmq_send (server, content, 32, 0);
assert (rc == 32);
assert ((rc == 32) || ((rc == -1) && (errno == EAGAIN)));
// Receive message at client side (should not succeed)
rc = zmq_setsockopt (client, ZMQ_RCVTIMEO, &timeout, sizeof (int));
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment