mirror of
https://github.com/zeromq/libzmq.git
synced 2025-01-03 03:45:43 +08:00
Merge pull request #355 from hurtonm/fq_lb_fix
Prevent connection starvation
This commit is contained in:
commit
bc150de81e
@ -46,10 +46,13 @@ void zmq::fq_t::attach (pipe_t *pipe_)
|
||||
|
||||
void zmq::fq_t::terminated (pipe_t *pipe_)
|
||||
{
|
||||
const pipes_t::size_type index = pipes.index (pipe_);
|
||||
|
||||
// Remove the pipe from the list; adjust number of active pipes
|
||||
// accordingly.
|
||||
if (pipes.index (pipe_) < active) {
|
||||
if (index < active) {
|
||||
active--;
|
||||
pipes.swap (index, active);
|
||||
if (current == active)
|
||||
current = 0;
|
||||
}
|
||||
|
@ -58,6 +58,7 @@ void zmq::lb_t::terminated (pipe_t *pipe_)
|
||||
// accordingly.
|
||||
if (index < active) {
|
||||
active--;
|
||||
pipes.swap (index, active);
|
||||
if (current == active)
|
||||
current = 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user