From 0b59866a84f733e5a53b0d2f32570581691747ef Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Mon, 30 May 2011 10:07:34 +0200 Subject: Patches from sub-forward branch incorporated Signed-off-by: Martin Sustrik --- src/session.cpp | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) (limited to 'src/session.cpp') diff --git a/src/session.cpp b/src/session.cpp index 5601402..c9f4fdb 100644 --- a/src/session.cpp +++ b/src/session.cpp @@ -146,6 +146,13 @@ void zmq::session_t::write_activated (pipe_t *pipe_) engine->activate_in (); } +void zmq::session_t::hiccuped (pipe_t *pipe_) +{ + // Hiccups are always sent from session to socket, not the other + // way round. + zmq_assert (false); +} + void zmq::session_t::process_plug () { } @@ -287,4 +294,25 @@ void zmq::session_t::unregister_session (const blob_t &name_) socket->unregister_session (name_); } +bool zmq::session_t::attached (const blob_t &peer_identity_) +{ + return xattached (peer_identity_); +} + +void zmq::session_t::detached () +{ + if (!xdetached ()) { + + // Derived session type have asked for session termination. + terminate (); + return; + } + + // For subscriber sockets we hiccup the inbound pipe, which will cause + // the socket object to resend all the subscriptions. + if (pipe && (options.type == ZMQ_SUB || options.type == ZMQ_XSUB)) + pipe->hiccup (); +} + + -- cgit v1.2.3