Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fix for issue #307 #291

Merged
merged 1 commit into from

2 participants

Douglas Young Ian Barber
Douglas Young

dist_t distribute() was skipping over pipes when one failed because the non-working pipe got swapped with a working pipe but the write was never retried on that pipe. This fix retries the write with the same index so the newly swapped pipe is also written to. This should stop apparently dropped PUB/XPUB messages due to closed SUB sockets.

Douglas Young rcxdude Fix for issue #307
dist was skipping over pipes when one failed because the non-working pipe got
swapped with a working pipe but the write was never retried on that pipe
084e1c2
Ian Barber ianbarber merged commit 4c93fc2 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Mar 25, 2012
  1. Douglas Young

    Fix for issue #307

    rcxdude authored
    dist was skipping over pipes when one failed because the non-working pipe got
    swapped with a working pipe but the write was never retried on that pipe
This page is out of date. Refresh to see the latest.
Showing with 5 additions and 2 deletions.
  1. +5 −2 src/dist.cpp
7 src/dist.cpp
View
@@ -139,7 +139,8 @@ void zmq::dist_t::distribute (msg_t *msg_, int flags_)
if (msg_->is_vsm ()) {
for (pipes_t::size_type i = 0; i < matching; ++i)
- write (pipes [i], msg_);
+ if(!write (pipes [i], msg_))
+ --i; // Retry last write because index will have been swapped
int rc = msg_->close();
errno_assert (rc == 0);
rc = msg_->init ();
@@ -154,8 +155,10 @@ void zmq::dist_t::distribute (msg_t *msg_, int flags_)
// Push copy of the message to each matching pipe.
int failed = 0;
for (pipes_t::size_type i = 0; i < matching; ++i)
- if (!write (pipes [i], msg_))
+ if (!write (pipes [i], msg_)) {
++failed;
+ --i; // Retry last write because index will have been swapped
+ }
if (unlikely (failed))
msg_->rm_refs (failed);
Something went wrong with that request. Please try again.