From 0f6f7276e32c01ccfe86fb76741a52ac6ffc87af Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Mon, 23 May 2011 20:30:01 +0200 Subject: Move the pipe termination code to socket_base_t So far, the pipe termination code was spread among socket type classes, fair queuer, load balancer, etc. This patch moves all the associated logic to a single place. Signed-off-by: Martin Sustrik --- src/pair.cpp | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) (limited to 'src/pair.cpp') diff --git a/src/pair.cpp b/src/pair.cpp index 93a4327..30b56e6 100644 --- a/src/pair.cpp +++ b/src/pair.cpp @@ -25,8 +25,7 @@ zmq::pair_t::pair_t (class ctx_t *parent_, uint32_t tid_) : socket_base_t (parent_, tid_), - pipe (NULL), - terminating (false) + pipe (NULL) { options.type = ZMQ_PAIR; } @@ -39,44 +38,22 @@ zmq::pair_t::~pair_t () void zmq::pair_t::xattach_pipe (pipe_t *pipe_, const blob_t &peer_identity_) { zmq_assert (!pipe); - pipe = pipe_; - pipe->set_event_sink (this); - - if (terminating) { - register_term_acks (1); - pipe_->terminate (); - } } -void zmq::pair_t::terminated (pipe_t *pipe_) +void zmq::pair_t::xterminated (pipe_t *pipe_) { zmq_assert (pipe_ == pipe); pipe = NULL; - - if (terminating) - unregister_term_ack (); -} - -void zmq::pair_t::process_term (int linger_) -{ - terminating = true; - - if (pipe) { - register_term_acks (1); - pipe->terminate (); - } - - socket_base_t::process_term (linger_); } -void zmq::pair_t::read_activated (pipe_t *pipe_) +void zmq::pair_t::xread_activated (pipe_t *pipe_) { // There's just one pipe. No lists of active and inactive pipes. // There's nothing to do here. } -void zmq::pair_t::write_activated (pipe_t *pipe_) +void zmq::pair_t::xwrite_activated (pipe_t *pipe_) { // There's just one pipe. No lists of active and inactive pipes. // There's nothing to do here. -- cgit v1.2.3