summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2010-06-17 11:01:18 +0200
committerMartin Sustrik <sustrik@250bpm.com>2010-06-17 11:01:18 +0200
commit9151de38959a21829d4ab60324d6750d2e1a4357 (patch)
treee9f73e2b6d38d0eefec03619308586b66f76d4dc
parent341e8a267309179bbb8249845e7efb14faf93d4d (diff)
generate identity for transient inproc connections
-rw-r--r--src/socket_base.cpp12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/socket_base.cpp b/src/socket_base.cpp
index 62a7465..cca83f7 100644
--- a/src/socket_base.cpp
+++ b/src/socket_base.cpp
@@ -39,6 +39,7 @@
#include "pgm_sender.hpp"
#include "pgm_receiver.hpp"
#include "likely.hpp"
+#include "uuid.hpp"
zmq::socket_base_t::socket_base_t (app_thread_t *parent_) :
object_t (parent_),
@@ -628,7 +629,16 @@ void zmq::socket_base_t::attach_pipes (class reader_t *inpipe_,
inpipe_->set_endpoint (this);
if (outpipe_)
outpipe_->set_endpoint (this);
- xattach_pipes (inpipe_, outpipe_, peer_identity_);
+
+ // If the peer haven't specified it's identity, let's generate one.
+ if (peer_identity_.size ()) {
+ xattach_pipes (inpipe_, outpipe_, peer_identity_);
+ }
+ else {
+ blob_t identity (0, 1);
+ identity += uuid_t ().to_blob ();
+ xattach_pipes (inpipe_, outpipe_, identity);
+ }
}
void zmq::socket_base_t::detach_inpipe (class reader_t *pipe_)