summaryrefslogtreecommitdiff
path: root/src/session.cpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2010-02-19 15:24:43 +0100
committerMartin Sustrik <sustrik@250bpm.com>2010-02-19 15:24:43 +0100
commit75f571c8844231f4172f131e1dd6ba2348eb54e5 (patch)
tree035106d6f65e69613a16470f9188d3aabab51179 /src/session.cpp
parentb9caa319e279cd8cd367e0a64308b9e80c4ead3d (diff)
Multi-hop REQ/REP, part XII., generate unique identities for anonymous connections
Diffstat (limited to 'src/session.cpp')
-rw-r--r--src/session.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/session.cpp b/src/session.cpp
index 74bd8ae..05f319c 100644
--- a/src/session.cpp
+++ b/src/session.cpp
@@ -50,7 +50,7 @@ zmq::session_t::session_t (object_t *parent_, socket_base_t *owner_,
peer_identity (peer_identity_),
options (options_)
{
- if (!peer_identity.empty ()) {
+ if (!peer_identity.empty () && peer_identity [0] != 0) {
if (!owner->register_session (peer_identity, this)) {
// TODO: There's already a session with the specified
@@ -103,7 +103,7 @@ void zmq::session_t::detach (owned_t *reconnecter_)
engine = NULL;
// Terminate transient session.
- if (!ordinal && peer_identity.empty ())
+ if (!ordinal && (peer_identity.empty () || peer_identity [0] == 0))
term ();
}
@@ -173,7 +173,7 @@ void zmq::session_t::process_unplug ()
// Unregister the session from the socket.
if (ordinal)
owner->unregister_session (ordinal);
- else if (!peer_identity.empty ())
+ else if (!peer_identity.empty () && peer_identity [0] != 0)
owner->unregister_session (peer_identity);
// Ask associated pipes to terminate.