summaryrefslogtreecommitdiff
path: root/src/xrep.cpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2010-10-01 13:37:46 +0200
committerMartin Sustrik <sustrik@250bpm.com>2010-10-01 13:37:46 +0200
commit0bb76b667b277b143a9a2901e8bf407f34da469d (patch)
treec4710c4b4052c278bce66aaaf6247a941e17a873 /src/xrep.cpp
parentac9b05c36b9d1f5bb3f8465b4c56478c399a01f3 (diff)
assert when xrep socket gets reconnected in the middle of the shutdown -- fixed
Diffstat (limited to 'src/xrep.cpp')
-rw-r--r--src/xrep.cpp35
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 ();
+ }
}
}