diff options
author | Martin Sustrik <sustrik@250bpm.com> | 2010-10-01 13:37:46 +0200 |
---|---|---|
committer | Martin Sustrik <sustrik@250bpm.com> | 2010-10-01 13:37:46 +0200 |
commit | 0bb76b667b277b143a9a2901e8bf407f34da469d (patch) | |
tree | c4710c4b4052c278bce66aaaf6247a941e17a873 | |
parent | ac9b05c36b9d1f5bb3f8465b4c56478c399a01f3 (diff) |
assert when xrep socket gets reconnected in the middle of the shutdown -- fixed
-rw-r--r-- | src/xrep.cpp | 35 |
1 files changed, 22 insertions, 13 deletions
diff --git a/src/xrep.cpp b/src/xrep.cpp index a6c3cf6..96f991a 100644 --- a/src/xrep.cpp +++ b/src/xrep.cpp @@ -50,24 +50,33 @@ zmq::xrep_t::~xrep_t () void zmq::xrep_t::xattach_pipes (reader_t *inpipe_, writer_t *outpipe_, const blob_t &peer_identity_) { - zmq_assert (inpipe_ && outpipe_); + if (outpipe_) { - outpipe_->set_event_sink (this); + outpipe_->set_event_sink (this); - // TODO: What if new connection has same peer identity as the old one? - outpipe_t outpipe = {outpipe_, true}; - bool ok = outpipes.insert (std::make_pair ( - peer_identity_, outpipe)).second; - zmq_assert (ok); + // TODO: What if new connection has same peer identity as the old one? + outpipe_t outpipe = {outpipe_, true}; + bool ok = outpipes.insert (std::make_pair ( + peer_identity_, outpipe)).second; + zmq_assert (ok); + + if (terminating) { + register_term_acks (1); + outpipe_->terminate (); + } + } + + if (inpipe_) { - inpipe_->set_event_sink (this); + inpipe_->set_event_sink (this); - inpipe_t inpipe = {inpipe_, peer_identity_, true}; - inpipes.push_back (inpipe); + inpipe_t inpipe = {inpipe_, peer_identity_, true}; + inpipes.push_back (inpipe); - if (terminating) { - register_term_acks (1); - inpipe_->terminate (); + if (terminating) { + register_term_acks (1); + inpipe_->terminate (); + } } } |