Commit 7045a4a2 authored by Martin Sustrik's avatar Martin Sustrik

Dead code removed from named_session.cpp

Signed-off-by: 's avatarMartin Sustrik <sustrik@250bpm.com>
parent f987f4b3
......@@ -23,63 +23,38 @@
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_) :
const blob_t &peer_identity_) :
session_t (io_thread_, socket_, options_),
name (name_)
peer_identity (peer_identity_)
{
// Make double sure that the session has valid name.
zmq_assert (!name.empty ());
zmq_assert (name [0] != 0);
// Make double sure that the peer's identity is not transient.
zmq_assert (!peer_identity.empty ());
zmq_assert (peer_identity [0] != 0);
if (!socket_->register_session (name, this)) {
bool ok = socket_->register_session (peer_identity, this);
// TODO: There's already a session with the specified
// identity. We should log the error and drop the
// session.
zmq_assert (false);
}
// If new session is being created, the caller should have already
// checked that the session for specified identity doesn't exist yet.
// Thus, register_session should not fail.
zmq_assert (ok);
}
zmq::named_session_t::~named_session_t ()
{
// Unregister the session from the global list of named sessions.
if (!name.empty ())
unregister_session (name);
unregister_session (peer_identity);
}
void zmq::named_session_t::attached (const blob_t &peer_identity_)
{
if (!name.empty ()) {
// If both IDs are temporary, no checking is needed.
// TODO: Old ID should be reused in this case...
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 (name == peer_identity_);
}
}
else if (!peer_identity_.empty ()) {
// Store the peer identity.
name = peer_identity_;
// Register the session using the peer name.
if (!register_session (name, this)) {
// TODO: There's already a session with the specified
// identity. We should presumably syslog it and drop the
// session.
zmq_assert (false);
}
}
// The owner should take care to not attach the session
// to an unrelated peer.
zmq_assert (peer_identity == peer_identity_);
}
void zmq::named_session_t::detached ()
{
// Do nothing. Named sessions are never destroyed because of disconnection,
// neither they have to actively reconnect.
// Do nothing. Named sessions are never destroyed because of disconnection.
// Neither they have to actively reconnect.
}
......@@ -36,7 +36,7 @@ namespace zmq
named_session_t (class io_thread_t *io_thread_,
class socket_base_t *socket_, const options_t &options_,
const blob_t &name_);
const blob_t &peer_identity_);
~named_session_t ();
// Handlers for events from session base class.
......@@ -45,8 +45,7 @@ namespace zmq
private:
// Name of the session. Corresponds to the peer's strong identity.
blob_t name;
blob_t peer_identity;
named_session_t (const named_session_t&);
const named_session_t &operator = (const named_session_t&);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment