Merge pull request #99 from leewoosung/hotfixes/patched

Backport for LIBZMQ-541 fix
This commit is contained in:
Pieter Hintjens 2013-07-15 00:52:12 -07:00
commit 2aca7b233b

13
src/dist.cpp Normal file → Executable file
View File

@ -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_);
}