From 9b8993efb48ccbe3df917338cc078129b5af495b Mon Sep 17 00:00:00 2001 From: Martin Sustrik Date: Tue, 24 Aug 2010 11:19:22 +0200 Subject: elementary fixes to the named session --- src/named_session.cpp | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) (limited to 'src/named_session.cpp') diff --git a/src/named_session.cpp b/src/named_session.cpp index d219286..131ea6b 100644 --- a/src/named_session.cpp +++ b/src/named_session.cpp @@ -20,7 +20,6 @@ #include "named_session.hpp" #include "socket_base.hpp" -/* zmq::named_session_t::named_session_t (class io_thread_t *io_thread_, socket_base_t *socket_, const options_t &options_, const blob_t &name_) : @@ -46,31 +45,33 @@ zmq::named_session_t::~named_session_t () void zmq::named_session_t::detach () { - // TODO: - zmq_assert (false); + // Clean up the mess left over by the failed connection. + clean_pipes (); + + // Do nothing. Wait till the connection comes up again. } void zmq::named_session_t::attached (const blob_t &peer_identity_) { - if (!peer_identity.empty ()) { + if (!name.empty ()) { // If both IDs are temporary, no checking is needed. // TODO: Old ID should be reused in this case... - if (peer_identity.empty () || peer_identity [0] != 0 || + if (name.empty () || name [0] != 0 || peer_identity_.empty () || peer_identity_ [0] != 0) { // If we already know the peer name do nothing, just check whether // it haven't changed. - zmq_assert (peer_identity == peer_identity_); + zmq_assert (name == peer_identity_); } } else if (!peer_identity_.empty ()) { // Store the peer identity. - peer_identity = peer_identity_; + name = peer_identity_; // Register the session using the peer name. - if (!register_session (peer_identity, this)) { + if (!register_session (name, this)) { // TODO: There's already a session with the specified // identity. We should presumably syslog it and drop the @@ -82,6 +83,6 @@ void zmq::named_session_t::attached (const blob_t &peer_identity_) void zmq::named_session_t::detached () { - socket->unregister_session (peer_identity); + unregister_session (name); } -*/ + -- cgit v1.2.3