mirror of
https://github.com/zeromq/libzmq.git
synced 2025-01-16 20:41:18 +08:00
Store identity for raw socket
Identity stored during connect procedure. Can be read using zmq_getsockopt and used as the identity frame when sending messages. This allows the implementation of a raw socket client.
This commit is contained in:
parent
e9d11c6611
commit
b893ce2503
@ -372,6 +372,9 @@ bool zmq::router_t::identify_peer (pipe_t *pipe_)
|
|||||||
buf [0] = 0;
|
buf [0] = 0;
|
||||||
put_uint32 (buf + 1, next_peer_id++);
|
put_uint32 (buf + 1, next_peer_id++);
|
||||||
identity = blob_t (buf, sizeof buf);
|
identity = blob_t (buf, sizeof buf);
|
||||||
|
unsigned int i = 0; // Store identity to allow use of raw socket as client
|
||||||
|
for (blob_t::iterator it = identity.begin(); it != identity.end(); it++) options.identity[i++] = *it;
|
||||||
|
options.identity_size = i;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
msg.init ();
|
msg.init ();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user