summaryrefslogtreecommitdiff
path: root/src/socket_base.cpp
diff options
context:
space:
mode:
authorMartin Sustrik <sustrik@250bpm.com>2011-11-05 09:57:17 +0100
committerMartin Sustrik <sustrik@250bpm.com>2011-11-05 09:57:17 +0100
commita756956781973d207413d675b998ae47de47b7c7 (patch)
treeb41970798b7f3e584b87e5aa01505ba849de68c2 /src/socket_base.cpp
parentde1d32daaedce51f655fe73e60988733b2db6557 (diff)
Use identities in inproc transport
Previous patches have missed the case when the identity should be sent from an inproc endpoint. Fixed. Signed-off-by: Martin Sustrik <sustrik@250bpm.com>
Diffstat (limited to 'src/socket_base.cpp')
-rw-r--r--src/socket_base.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/socket_base.cpp b/src/socket_base.cpp
index a59ba69..ced28d4 100644
--- a/src/socket_base.cpp
+++ b/src/socket_base.cpp
@@ -415,6 +415,17 @@ int zmq::socket_base_t::connect (const char *addr_)
// Attach local end of the pipe to this socket object.
attach_pipe (pipes [0]);
+ // If required, send the identity of the local socket to the peer.
+ if (options.send_identity) {
+ msg_t id;
+ rc = id.init_size (options.identity_size);
+ zmq_assert (rc == 0);
+ memcpy (id.data (), options.identity, options.identity_size);
+ id.set_flags (msg_t::identity);
+ bool written = pipes [0]->write (&id);
+ zmq_assert (written);
+ }
+
// Attach remote end of the pipe to the peer socket. Note that peer's
// seqnum was incremented in find_endpoint function. We don't need it
// increased here.