summaryrefslogtreecommitdiff
path: root/src/xreq.cpp
diff options
context:
space:
mode:
authorsustrik <sustrik@250bpm.com>2011-11-04 02:15:37 -0700
committersustrik <sustrik@250bpm.com>2011-11-04 02:15:37 -0700
commit6cdd720400ea456ccbfdf09cdc5054ab07dbdc6f (patch)
tree6a25ede64ac1252e022feb91b1342cdc38e3dcf5 /src/xreq.cpp
parent541b83bc02784c721efa3d9dde8f8a191c3c3b7b (diff)
parente9c3a227a7175b4eda5193b1c8ce6985f5ed89f3 (diff)
Merge pull request #220 from 250bpm/HEAD
Refactoring
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 ()