summaryrefslogtreecommitdiff
path: root/src/fq.cpp
diff options
context:
space:
mode:
authorMartin Hurton <hurtonm@gmail.com>2010-02-10 12:47:34 +0100
committerMartin Hurton <hurtonm@gmail.com>2010-02-10 16:59:17 +0100
commit6b3c1798e7554dd1ce63b2ad137e327f3f32fcf1 (patch)
treed3856814d17d409a2e9837bbdca8724efcf2bd93 /src/fq.cpp
parent8c25bab31d63bf5e2c4eec6d9084cf7d1c1e5dd3 (diff)
fq: bugfix - don't read msg from inactive pipe
Diffstat (limited to 'src/fq.cpp')
-rw-r--r--src/fq.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/fq.cpp b/src/fq.cpp
index e23e302..1836058 100644
--- a/src/fq.cpp
+++ b/src/fq.cpp
@@ -46,8 +46,11 @@ void zmq::fq_t::detach (reader_t *pipe_)
{
// Remove the pipe from the list; adjust number of active pipes
// accordingly.
- if (pipes.index (pipe_) < active)
+ if (pipes.index (pipe_) < active) {
active--;
+ if (current == active)
+ current = 0;
+ }
pipes.erase (pipe_);
}
@@ -55,6 +58,8 @@ void zmq::fq_t::kill (reader_t *pipe_)
{
// Move the pipe to the list of inactive pipes.
active--;
+ if (current == active)
+ current = 0;
pipes.swap (pipes.index (pipe_), active);
}