Skip to content

Commit

Permalink
Merge pull request #116 from daveab/master
Browse files Browse the repository at this point in the history
Fix race to crash: when a message is sent as the last connection is lost

Fixes #1002
  • Loading branch information
hintjens committed May 2, 2014
2 parents 6077e52 + 00e5b37 commit 346527a
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/lb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,8 @@ int zmq::lb_t::send (msg_t *msg_, int flags_)
more = msg_->flags () & msg_t::more? true: false;
if (!more) {
pipes [current]->flush ();
current = (current + 1) % active;
if (++current >= active)
current = 0;
}

// Detach the message from the data buffer.
Expand Down

0 comments on commit 346527a

Please sign in to comment.