summaryrefslogtreecommitdiff
path: root/src/socket_base.cpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2011-06-22 11:02:16 +0200
committerMartin Sustrik <sustrik@250bpm.com>2011-06-22 11:02:16 +0200
commitec81f8fb2523e1e2fe45eaadc05311a35bf551d7 (patch)
treee6fbd9b7a789d72678fa02ca06883de15a932beb /src/socket_base.cpp
parent10a93bb79fd3d4be1b3ffedfa6785564fbcc082b (diff)
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 <sustrik@250bpm.com>
Diffstat (limited to 'src/socket_base.cpp')
-rw-r--r--src/socket_base.cpp18
1 files changed, 9 insertions, 9 deletions
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.