mirror of
https://github.com/zeromq/libzmq.git
synced 2025-03-09 15:26:04 +00:00
Problem: routing ID cycles back to zero
It should never be zero. Solution: if rid cycles back to zero, bump to 1.
This commit is contained in:
parent
60fdfd9a1b
commit
5e936fe955
@ -54,6 +54,9 @@ void zmq::server_t::xattach_pipe (pipe_t *pipe_, bool subscribe_to_all_)
|
|||||||
zmq_assert (pipe_);
|
zmq_assert (pipe_);
|
||||||
|
|
||||||
uint32_t routing_id = next_rid++;
|
uint32_t routing_id = next_rid++;
|
||||||
|
if (!routing_id)
|
||||||
|
routing_id = next_rid++; // Never use RID zero
|
||||||
|
|
||||||
pipe_->set_routing_id (routing_id);
|
pipe_->set_routing_id (routing_id);
|
||||||
// Add the record into output pipes lookup table
|
// Add the record into output pipes lookup table
|
||||||
outpipe_t outpipe = {pipe_, true};
|
outpipe_t outpipe = {pipe_, true};
|
||||||
@ -113,9 +116,10 @@ int zmq::server_t::xsend (msg_t *msg_)
|
|||||||
// Message failed to send - we must close it ourselves.
|
// Message failed to send - we must close it ourselves.
|
||||||
int rc = msg_->close ();
|
int rc = msg_->close ();
|
||||||
errno_assert (rc == 0);
|
errno_assert (rc == 0);
|
||||||
} else {
|
|
||||||
it->second.pipe->flush ();
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
it->second.pipe->flush ();
|
||||||
|
|
||||||
|
|
||||||
// Detach the message from the data buffer.
|
// Detach the message from the data buffer.
|
||||||
int rc = msg_->init ();
|
int rc = msg_->init ();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user