summaryrefslogtreecommitdiff
path: root/src/named_session.cpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2010-08-24 11:19:22 +0200
committerMartin Sustrik <sustrik@250bpm.com>2010-08-25 15:39:21 +0200
commit9b8993efb48ccbe3df917338cc078129b5af495b (patch)
treec9234c0c67d26818cb5691951bbffd9c1cd015b0 /src/named_session.cpp
parent46d70555659c05a0c8d95c6d7aa8c7e0cc5ebc66 (diff)
elementary fixes to the named session
Diffstat (limited to 'src/named_session.cpp')
-rw-r--r--src/named_session.cpp21
1 files changed, 11 insertions, 10 deletions
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);
}
-*/
+