summaryrefslogtreecommitdiff
path: root/src/session.cpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2010-10-13 10:09:46 +0200
committerMartin Sustrik <sustrik@250bpm.com>2010-10-13 10:09:46 +0200
commit9d96e0037a9d027fd286f771fa2a8db5def485c8 (patch)
tree8fe87b67d46182651a2fb54675ea102e220974f5 /src/session.cpp
parent5ae878b891fa5189f5202f1577d22bdb9ba51f77 (diff)
Clean-up of the code related to attaching/detaching engines to sessions.
Session base class now handles the engine events exclusively. It notifies derived session types using dedicated "attached" and "detached" events. Couple of bugs was fixed along the way. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src/session.cpp')
-rw-r--r--src/session.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/src/session.cpp b/src/session.cpp
index 76e782b..d5c6fdd 100644
--- a/src/session.cpp
+++ b/src/session.cpp
@@ -260,7 +260,15 @@ void zmq::session_t::detach ()
// Engine is dead. Let's forget about it.
engine = NULL;
+ // Remove any half-done messages from the pipes.
+ clean_pipes ();
+
+ // Send the event to the derived class.
detached ();
+
+ // Just in case, there's only a delimiter in the inbound pipe.
+ if (in_pipe)
+ in_pipe->check_read ();
}
void zmq::session_t::process_term ()
@@ -293,16 +301,6 @@ void zmq::session_t::unregister_session (const blob_t &name_)
socket->unregister_session (name_);
}
-void zmq::session_t::attached (const blob_t &peer_identity_)
-{
-}
-
-void zmq::session_t::detached ()
-{
- if (in_pipe)
- in_pipe->check_read ();
-}
-
void zmq::session_t::terminate ()
{
force_terminate = true;