summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2011-05-02 19:26:30 +0200
committerMartin Sustrik <sustrik@250bpm.com>2011-05-02 19:26:30 +0200
commite5d4cd39e1c9949b549055f816d60dd35bfacdec (patch)
treed471916d6a428024c7d8c9f2e2e602fd99db3f13
parente78cc47b184f82fd524da021745b3323df4af507 (diff)
Yet one more fix related to PUB socket and multipart messages
This patch fixes the activation of the pipes, when they pass from passive state directly to active. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
-rw-r--r--src/dist.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/dist.cpp b/src/dist.cpp
index 9201294..c15ab6b 100644
--- a/src/dist.cpp
+++ b/src/dist.cpp
@@ -90,17 +90,15 @@ void zmq::dist_t::terminated (writer_t *pipe_)
void zmq::dist_t::activated (writer_t *pipe_)
{
- // If we are in the middle of sending a message, we'll add the pipe
- // into the list of eligible pipes. Otherwise we add it to the list
- // of active pipes.
- if (more) {
- pipes.swap (pipes.index (pipe_), eligible);
- eligible++;
- }
- else {
- pipes.swap (pipes.index (pipe_), active);
+ // Move the pipe from passive to eligible state.
+ pipes.swap (pipes.index (pipe_), eligible);
+ eligible++;
+
+ // If there's no message being sent at the moment, move it to
+ // the active state.
+ if (!more) {
+ pipes.swap (eligible - 1, active);
active++;
- eligible++;
}
}