mirror of
https://github.com/zeromq/libzmq.git
synced 2025-03-04 07:27:26 +01:00
Prevent connection starvation
When removing a pipe from the lb or fq component, make sure we do not remove another pipe from the active set.
This commit is contained in:
parent
4e7be102f4
commit
2973eaf446
@ -46,10 +46,13 @@ void zmq::fq_t::attach (pipe_t *pipe_)
|
|||||||
|
|
||||||
void zmq::fq_t::terminated (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
|
// Remove the pipe from the list; adjust number of active pipes
|
||||||
// accordingly.
|
// accordingly.
|
||||||
if (pipes.index (pipe_) < active) {
|
if (index < active) {
|
||||||
active--;
|
active--;
|
||||||
|
pipes.swap (index, active);
|
||||||
if (current == active)
|
if (current == active)
|
||||||
current = 0;
|
current = 0;
|
||||||
}
|
}
|
||||||
|
@ -58,6 +58,7 @@ void zmq::lb_t::terminated (pipe_t *pipe_)
|
|||||||
// accordingly.
|
// accordingly.
|
||||||
if (index < active) {
|
if (index < active) {
|
||||||
active--;
|
active--;
|
||||||
|
pipes.swap (index, active);
|
||||||
if (current == active)
|
if (current == active)
|
||||||
current = 0;
|
current = 0;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user