summaryrefslogtreecommitdiff
path: root/src/req.cpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2011-11-04 08:00:47 +0100
committerMartin Sustrik <sustrik@250bpm.com>2011-11-04 08:00:47 +0100
commita4843b65d24f9caa188bb2454b28080f0cee8484 (patch)
tree9fb56a811f693c968074433fe899ce7dd55a76fe /src/req.cpp
parentd20ea25b8c63e148fe48cc2b85bac9c896f1073b (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/req.cpp')
-rw-r--r--src/req.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/req.cpp b/src/req.cpp
index 40c4765..3ba1ec0 100644
--- a/src/req.cpp
+++ b/src/req.cpp
@@ -147,23 +147,32 @@ zmq::req_session_t::req_session_t (io_thread_t *io_thread_, bool connect_,
zmq::req_session_t::~req_session_t ()
{
+ state = options.recv_identity ? identity : bottom;
}
int zmq::req_session_t::write (msg_t *msg_)
{
- if (state == bottom) {
+ switch (state) {
+ case bottom:
if (msg_->flags () == msg_t::more && msg_->size () == 0) {
state = body;
return xreq_session_t::write (msg_);
}
- }
- else {
+ break;
+ case body:
if (msg_->flags () == msg_t::more)
return xreq_session_t::write (msg_);
if (msg_->flags () == 0) {
state = bottom;
return xreq_session_t::write (msg_);
}
+ break;
+ case identity:
+ if (msg_->flags () == 0) {
+ state = bottom;
+ return xreq_session_t::write (msg_);
+ }
+ break;
}
errno = EFAULT;
return -1;