summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/fq.cpp7
-rw-r--r--src/lb.cpp6
2 files changed, 8 insertions, 5 deletions
diff --git a/src/fq.cpp b/src/fq.cpp
index 7eef564..9832c21 100644
--- a/src/fq.cpp
+++ b/src/fq.cpp
@@ -148,8 +148,11 @@ bool zmq::fq_t::has_in ()
for (int count = active; count != 0; count--) {
if (pipes [current]->check_read ())
return true;
- current++;
- if (current >= active)
+
+ // Deactivate the pipe.
+ active--;
+ pipes.swap (current, active);
+ if (current == active)
current = 0;
}
diff --git a/src/lb.cpp b/src/lb.cpp
index 53f8f58..7a28d47 100644
--- a/src/lb.cpp
+++ b/src/lb.cpp
@@ -135,10 +135,10 @@ bool zmq::lb_t::has_out ()
if (pipes [current]->check_write ())
return true;
+ // Deactivate the pipe.
active--;
- if (current < active)
- pipes.swap (current, active);
- else
+ pipes.swap (current, active);
+ if (current == active)
current = 0;
}