Skip to content

Commit

Permalink
Merge pull request #614 from ckamm/fix-spec-req-fail
Browse files Browse the repository at this point in the history
Fix intermittent failure in test_spec_req.
  • Loading branch information
hintjens committed Jul 14, 2013
2 parents bccf3d6 + 7de23c0 commit 4fb004f
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion tests/test_spec_req.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,17 @@ void test_req_only_listens_to_current_peer (void *ctx)
assert (rc == 0);
}

// Wait for connects to finish.
rc = zmq_poll (0, 0, 100);
assert (rc == 0);

for (size_t i = 0; i < services; ++i) {
// There still is a race condition when a stale peer's message
// arrives at the REQ just after a request was sent to that peer.
// To avoid that happening in the test, sleep for a bit.
rc = zmq_poll (0, 0, 10);
assert (rc == 0);

s_send_seq (req, "ABC", SEQ_END);

// Receive on router i
Expand All @@ -112,7 +122,7 @@ void test_req_only_listens_to_current_peer (void *ctx)
s_send_seq (router [j], "A", 0, reply, SEQ_END);
}

// Recieve only the good relpy
// Receive only the good reply
s_recv_seq (req, "GOOD", SEQ_END);
}

Expand Down

0 comments on commit 4fb004f

Please sign in to comment.