summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2011-05-02 19:28:51 +0200
committerMartin Sustrik <sustrik@250bpm.com>2011-05-02 19:28:51 +0200
commit6ecec9bbf1cd17666241a3effc31a65e555dbd4a (patch)
treec1a41f131b72632054f98c3ec667cd7102e227a1
parente5d4cd39e1c9949b549055f816d60dd35bfacdec (diff)
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>
-rw-r--r--src/xrep.cpp4
1 files 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;
}
}