Skip to content

Commit

Permalink
test_stream failed when response was broken into frames
Browse files Browse the repository at this point in the history
  • Loading branch information
hintjens committed Oct 25, 2013
1 parent cd2afeb commit 8efd7af
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions tests/test_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,15 +89,14 @@ test_stream_to_dealer (void)
assert (rc == sizeof (greeting));

// Now we expect the data from the DEALER socket
// First frame is, again, the identity of the connection
rc = zmq_msg_recv (&identity, stream, 0);
assert (rc > 0);
assert (zmq_msg_more (&identity));

// Second frame contains the rest of greeting along with
// the Ready command
// We want the rest of greeting along with the Ready command
int bytes_read = 0;
while (bytes_read < 97) {
// First frame is the identity of the connection (each time)
rc = zmq_msg_recv (&identity, stream, 0);
assert (rc > 0);
assert (zmq_msg_more (&identity));
// Second frame contains the next chunk of data
rc = zmq_recv (stream, buffer + bytes_read, 255 - bytes_read, 0);
assert (rc >= 0);
bytes_read += rc;
Expand Down

0 comments on commit 8efd7af

Please sign in to comment.