Skip to content

Commit

Permalink
Merge pull request #1881 from camachat/master
Browse files Browse the repository at this point in the history
Fixes #1419 segfault when using a XSUB/XPUB proxy.
  • Loading branch information
c-rack committed Apr 2, 2016
2 parents a7922e5 + 023b34a commit 0feec7a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/dist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -124,12 +124,14 @@ void zmq::dist_t::pipe_terminated (pipe_t *pipe_)
void zmq::dist_t::activated (pipe_t *pipe_)
{
// Move the pipe from passive to eligible state.
pipes.swap (pipes.index (pipe_), eligible);
eligible++;
if (eligible < pipes.size ()) {
pipes.swap (pipes.index (pipe_), eligible);
eligible++;
}

// If there's no message being sent at the moment, move it to
// the active state.
if (!more) {
if (!more && active < pipes.size ()) {
pipes.swap (eligible - 1, active);
active++;
}
Expand Down

0 comments on commit 0feec7a

Please sign in to comment.