Skip to content

Commit e56bc48

Browse files
authored
Merge pull request #2327 from chutz/fix-divide-by-zero
fix divide by zero in zmq::lb_t::sendpipe
2 parents 5c34f65 + df7c684 commit e56bc48

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/lb.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,9 @@ int zmq::lb_t::sendpipe (msg_t *msg_, pipe_t **pipe_)
137137
more = msg_->flags () & msg_t::more? true: false;
138138
if (!more) {
139139
pipes [current]->flush ();
140-
current = (current + 1) % active;
140+
141+
if (++current >= active)
142+
current = 0;
141143
}
142144

143145
// Detach the message from the data buffer.

0 commit comments

Comments
 (0)