summaryrefslogtreecommitdiff
path: root/src/xreq.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/xreq.cpp')
-rw-r--r--src/xreq.cpp20
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 ()