mirror of
https://github.com/zeromq/libzmq.git
synced 2025-10-28 19:52:00 +01:00
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>
This commit is contained in:
15
src/req.cpp
15
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;
|
||||
|
||||
Reference in New Issue
Block a user