0
0
mirror of https://github.com/zeromq/libzmq.git synced 2025-01-15 10:18:01 +08:00

Merge pull request #116 from daveab/master

Fix race to crash: when a message is sent as the last connection is lost

Fixes #1002
This commit is contained in:
Pieter Hintjens 2014-05-02 18:36:36 +02:00
commit 346527a1cf

View File

@ -113,7 +113,8 @@ int zmq::lb_t::send (msg_t *msg_, int flags_)
more = msg_->flags () & msg_t::more? true: false; more = msg_->flags () & msg_t::more? true: false;
if (!more) { if (!more) {
pipes [current]->flush (); pipes [current]->flush ();
current = (current + 1) % active; if (++current >= active)
current = 0;
} }
// Detach the message from the data buffer. // Detach the message from the data buffer.