From ec81f8fb2523e1e2fe45eaadc05311a35bf551d7 Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Wed, 22 Jun 2011 11:02:16 +0200 Subject: New wire format for REQ/REP pattern This patch introduces two changes: 1. 32-bit ID is used to identify the peer instead of UUID 2. REQ socket seeds the label stack with unique 32-bit request ID It also drops any replies with non-matching request ID Signed-off-by: Martin Sustrik --- src/socket_base.cpp | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/socket_base.cpp') diff --git a/src/socket_base.cpp b/src/socket_base.cpp index eaf1776..804ec46 100644 --- a/src/socket_base.cpp +++ b/src/socket_base.cpp @@ -598,15 +598,15 @@ int zmq::socket_base_t::recv (msg_t *msg_, int flags_) ticks = 0; rc = xrecv (msg_, flags_); - if (rc == 0) { - rcvlabel = msg_->flags () & msg_t::label; - if (rcvlabel) - msg_->reset_flags (msg_t::label); - rcvmore = msg_->flags () & msg_t::more; - if (rcvmore) - msg_->reset_flags (msg_t::more); - } - return rc; + if (rc < 0) + return rc; + rcvlabel = msg_->flags () & msg_t::label; + if (rcvlabel) + msg_->reset_flags (msg_t::label); + rcvmore = msg_->flags () & msg_t::more; + if (rcvmore) + msg_->reset_flags (msg_t::more); + return 0; } // Compute the time when the timeout should occur. -- cgit v1.2.3