Commit 73e7ef37 authored by Martin Sustrik's avatar Martin Sustrik

When XREP silently drops message, it does not empty it -- fixed

Signed-off-by: 's avatarMartin Sustrik <sustrik@250bpm.com>
parent f5030a93
...@@ -173,23 +173,24 @@ int zmq::xrep_t::xsend (zmq_msg_t *msg_, int flags_) ...@@ -173,23 +173,24 @@ int zmq::xrep_t::xsend (zmq_msg_t *msg_, int flags_)
zmq_assert (!current_out); zmq_assert (!current_out);
// If we have malformed message (prefix with no subsequent message) // If we have malformed message (prefix with no subsequent message)
// then just silently drop the message. // then just silently ignore it.
if ((msg_->flags & ZMQ_MSG_MORE) == 0) if (msg_->flags & ZMQ_MSG_MORE) {
return 0;
more_out = true;
// Find the pipe associated with the identity stored in the prefix. more_out = true;
// If there's no such pipe just silently drop the message.
blob_t identity ((unsigned char*) zmq_msg_data (msg_),
zmq_msg_size (msg_));
outpipes_t::iterator it = outpipes.find (identity);
if (it == outpipes.end ())
return 0;
// Remember the outgoing pipe. // Find the pipe associated with the identity stored in the prefix.
current_out = it->second.writer; // If there's no such pipe just silently ignore the message.
blob_t identity ((unsigned char*) zmq_msg_data (msg_),
zmq_msg_size (msg_));
outpipes_t::iterator it = outpipes.find (identity);
if (it != outpipes.end ())
current_out = it->second.writer;
}
int rc = zmq_msg_close (msg_);
zmq_assert (rc == 0);
rc = zmq_msg_init (msg_);
zmq_assert (rc == 0);
return 0; return 0;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment