Commit 0bb76b66 authored by Martin Sustrik's avatar Martin Sustrik

assert when xrep socket gets reconnected in the middle of the shutdown -- fixed

parent ac9b05c3
...@@ -50,24 +50,33 @@ zmq::xrep_t::~xrep_t () ...@@ -50,24 +50,33 @@ zmq::xrep_t::~xrep_t ()
void zmq::xrep_t::xattach_pipes (reader_t *inpipe_, writer_t *outpipe_, void zmq::xrep_t::xattach_pipes (reader_t *inpipe_, writer_t *outpipe_,
const blob_t &peer_identity_) 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? // TODO: What if new connection has same peer identity as the old one?
outpipe_t outpipe = {outpipe_, true}; outpipe_t outpipe = {outpipe_, true};
bool ok = outpipes.insert (std::make_pair ( bool ok = outpipes.insert (std::make_pair (
peer_identity_, outpipe)).second; peer_identity_, outpipe)).second;
zmq_assert (ok); 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}; inpipe_t inpipe = {inpipe_, peer_identity_, true};
inpipes.push_back (inpipe); inpipes.push_back (inpipe);
if (terminating) { if (terminating) {
register_term_acks (1); register_term_acks (1);
inpipe_->terminate (); inpipe_->terminate ();
}
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment