From 1b5b18cba98052329e5a5b6a1a8c9e1104f344de Mon Sep 17 00:00:00 2001 From: WooSung Date: Thu, 27 Jun 2013 23:20:14 +0900 Subject: [PATCH] LIBZMQ-541 fix --- src/dist.cpp | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) mode change 100644 => 100755 src/dist.cpp diff --git a/src/dist.cpp b/src/dist.cpp old mode 100644 new mode 100755 index a8cb2ecf65..0ae86ec6b7 --- a/src/dist.cpp +++ b/src/dist.cpp @@ -80,12 +80,19 @@ void zmq::dist_t::terminated (pipe_t *pipe_) { // Remove the pipe from the list; adjust number of matching, active and/or // eligible pipes accordingly. - if (pipes.index (pipe_) < matching) + if (pipes.index (pipe_) < matching) { + pipes.swap (pipes.index (pipe_), matching - 1); matching--; - if (pipes.index (pipe_) < active) + } + if (pipes.index (pipe_) < active) { + pipes.swap (pipes.index (pipe_), active - 1); active--; - if (pipes.index (pipe_) < eligible) + } + if (pipes.index (pipe_) < eligible) { + pipes.swap (pipes.index (pipe_), eligible - 1); eligible--; + } + pipes.erase (pipe_); }