summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@fastmq.commkdir>2009-09-02 14:59:53 +0200
committerMartin Sustrik <sustrik@fastmq.commkdir>2009-09-02 14:59:53 +0200
commitf92de9b2a9ad73fd7cd966e65b5a06b725e779fc (patch)
tree119769a0bf8623e5c266c232eb1ee29cccaaa1af /src
parent702fdbb5dd6a83e7f656e8d1190e695ebb636765 (diff)
bug during terminal shutdown fixed
Diffstat (limited to 'src')
-rw-r--r--src/session.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/src/session.cpp b/src/session.cpp
index ef17d6d..ac2dd12 100644
--- a/src/session.cpp
+++ b/src/session.cpp
@@ -36,11 +36,8 @@ zmq::session_t::session_t (object_t *parent_, socket_base_t *owner_,
zmq::session_t::~session_t ()
{
- // Ask associated pipes to terminate.
- if (in_pipe)
- in_pipe->term ();
- if (out_pipe)
- out_pipe->term ();
+ zmq_assert (!in_pipe);
+ zmq_assert (!out_pipe);
}
bool zmq::session_t::read (::zmq_msg_t *msg_)
@@ -82,6 +79,7 @@ void zmq::session_t::attach_inpipe (reader_t *pipe_)
active = true;
in_pipe->set_endpoint (this);
}
+
void zmq::session_t::attach_outpipe (writer_t *pipe_)
{
zmq_assert (!out_pipe);
@@ -141,6 +139,16 @@ void zmq::session_t::process_unplug ()
bool ok = owner->unregister_session (name.c_str ());
zmq_assert (ok);
+ // Ask associated pipes to terminate.
+ if (in_pipe) {
+ in_pipe->term ();
+ in_pipe = NULL;
+ }
+ if (out_pipe) {
+ out_pipe->term ();
+ out_pipe = NULL;
+ }
+
if (engine) {
engine->unplug ();
delete engine;