diff options
author | Martin Sustrik <sustrik@250bpm.com> | 2011-11-04 09:48:25 +0100 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2011-11-04 09:48:25 +0100 |
commit | 05ce301f3571e3e690792a189cb927328163f0bc (patch) | |
tree | 1145b921033a2b88e9b987ec1d3e03060559702d /src/xreq.cpp | |
parent | a8362abf11b51dd553766fb07a9e60f28e788126 (diff) | |
parent | 6cdd720400ea456ccbfdf09cdc5054ab07dbdc6f (diff) |
Merge branch 'master' of github.com:zeromq/libzmq
Diffstat (limited to 'src/xreq.cpp')
-rw-r--r-- | src/xreq.cpp | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/src/xreq.cpp b/src/xreq.cpp index 79b3b94..91317f7 100644 --- a/src/xreq.cpp +++ b/src/xreq.cpp @@ -1,5 +1,6 @@ /* - Copyright (c) 2007-2011 iMatix Corporation + 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. @@ -27,9 +28,14 @@ zmq::xreq_t::xreq_t (class ctx_t *parent_, uint32_t tid_) : { options.type = ZMQ_XREQ; + // TODO: Uncomment the following line when XREQ will become true XREQ + // rather than generic dealer socket. // 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.delay_on_close = false; + + options.send_identity = true; + options.recv_identity = true; } zmq::xreq_t::~xreq_t () @@ -50,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 () |