0
0
mirror of https://github.com/zeromq/libzmq.git synced 2025-01-04 04:55:27 +08:00

Current inpipe remains unchaged in XREP when other pipe terminates

When an inpipe terminated within XREP, it was erased from the array
and thus current_in (which is an index) pointed to a different
element in the array. This caused problems when we were in the
middle of reading a multipart message.

Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
This commit is contained in:
Martin Sustrik 2011-05-02 19:28:51 +02:00
parent e5d4cd39e1
commit 6ecec9bbf1

View File

@ -101,10 +101,10 @@ void zmq::xrep_t::terminated (reader_t *pipe_)
++it) {
if (it->reader == pipe_) {
inpipes.erase (it);
if ((inpipes_t::size_type) (it - inpipes.begin ()) < current_in)
current_in--;
if (terminating)
unregister_term_ack ();
if (current_in >= inpipes.size ())
current_in = 0;
return;
}
}