From 6ecec9bbf1cd17666241a3effc31a65e555dbd4a Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Mon, 2 May 2011 19:28:51 +0200 Subject: 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 --- src/xrep.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/xrep.cpp b/src/xrep.cpp index 5e01e2f..2466f57 100644 --- a/src/xrep.cpp +++ b/src/xrep.cpp @@ -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; } } -- cgit v1.2.3