diff options
author | Martin Sustrik <sustrik@250bpm.com> | 2011-11-04 08:00:47 +0100 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2011-11-04 08:00:47 +0100 |
commit | a4843b65d24f9caa188bb2454b28080f0cee8484 (patch) | |
tree | 9fb56a811f693c968074433fe899ce7dd55a76fe /src/xreq.cpp | |
parent | d20ea25b8c63e148fe48cc2b85bac9c896f1073b (diff) |
Identities re-introduced
However, the "durable socket" behaviour wasn't re-added.
Identities are used solely for routing in REQ/REP pattern.
Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src/xreq.cpp')
-rw-r--r-- | src/xreq.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/xreq.cpp b/src/xreq.cpp index f4f962f..91317f7 100644 --- a/src/xreq.cpp +++ b/src/xreq.cpp @@ -1,5 +1,6 @@ /* Copyright (c) 2009-2011 250bpm s.r.o. + Copyright (c) 2011 VMware, Inc. Copyright (c) 2007-2011 Other contributors as noted in the AUTHORS file This file is part of 0MQ. @@ -32,6 +33,9 @@ zmq::xreq_t::xreq_t (class ctx_t *parent_, uint32_t tid_) : // If the socket is closing we can drop all the outbound requests. There'll // be noone to receive the replies anyway. // options.delay_on_close = false; + + options.send_identity = true; + options.recv_identity = true; } zmq::xreq_t::~xreq_t () @@ -52,7 +56,15 @@ int zmq::xreq_t::xsend (msg_t *msg_, int flags_) int zmq::xreq_t::xrecv (msg_t *msg_, int flags_) { - return fq.recv (msg_, flags_); + // XREQ socket doesn't use identities. We can safely drop it and + while (true) { + int rc = fq.recv (msg_, flags_); + if (rc != 0) + return rc; + if (likely (!(msg_->flags () & msg_t::identity))) + break; + } + return 0; } bool zmq::xreq_t::xhas_in () |