summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rep.cpp16
1 files changed, 14 insertions, 2 deletions
diff --git a/src/rep.cpp b/src/rep.cpp
index 755d78e..95ea0b1 100644
--- a/src/rep.cpp
+++ b/src/rep.cpp
@@ -71,13 +71,19 @@ void zmq::rep_t::xdetach_inpipe (class reader_t *pipe_)
active--;
in_pipes.swap (index, active);
out_pipes.swap (index, active);
+ if (current == active)
+ current = 0;
}
return;
}
// Now both inpipe and outpipe are detached. Remove them from the lists.
- if (index < active)
+ if (index < active) {
active--;
+ if (current == active)
+ current = 0;
+ }
+
in_pipes.erase (index);
out_pipes.erase (index);
}
@@ -103,13 +109,19 @@ void zmq::rep_t::xdetach_outpipe (class writer_t *pipe_)
active--;
in_pipes.swap (index, active);
out_pipes.swap (index, active);
+ if (current == active)
+ current = 0;
}
return;
}
// Now both inpipe and outpipe are detached. Remove them from the lists.
- if (out_pipes.index (pipe_) < active)
+ if (out_pipes.index (pipe_) < active) {
active--;
+ if (current == active)
+ current = 0;
+ }
+
in_pipes.erase (index);
out_pipes.erase (index);
}