Commit 6b3c1798 authored by Martin Hurton's avatar Martin Hurton

fq: bugfix - don't read msg from inactive pipe

parent 8c25bab3
...@@ -46,8 +46,11 @@ void zmq::fq_t::detach (reader_t *pipe_) ...@@ -46,8 +46,11 @@ void zmq::fq_t::detach (reader_t *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 (pipes.index (pipe_) < active) {
active--; active--;
if (current == active)
current = 0;
}
pipes.erase (pipe_); pipes.erase (pipe_);
} }
...@@ -55,6 +58,8 @@ void zmq::fq_t::kill (reader_t *pipe_) ...@@ -55,6 +58,8 @@ void zmq::fq_t::kill (reader_t *pipe_)
{ {
// Move the pipe to the list of inactive pipes. // Move the pipe to the list of inactive pipes.
active--; active--;
if (current == active)
current = 0;
pipes.swap (pipes.index (pipe_), active); pipes.swap (pipes.index (pipe_), active);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment