From 8efd7affc677cb9d40167137b27d99e9b670affc Mon Sep 17 00:00:00 2001 From: Pieter Hintjens Date: Wed, 23 Oct 2013 23:58:39 +0200 Subject: [PATCH] test_stream failed when response was broken into frames --- tests/test_stream.cpp | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/tests/test_stream.cpp b/tests/test_stream.cpp index 3e9a34e9..5e80f011 100644 --- a/tests/test_stream.cpp +++ b/tests/test_stream.cpp @@ -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;