mirror of
https://github.com/zeromq/libzmq.git
synced 2025-11-07 05:58:45 +01:00
Problem: ZMQ_CONNECT_ROUTING_ID can be assigned to incoming socket connection (Issue #3191)
Solution: Add an identifier parameter for local attach to zmq::socket_base_t::attach_pipe
This commit is contained in:
@@ -57,13 +57,15 @@ zmq::stream_t::~stream_t ()
|
||||
_prefetched_msg.close ();
|
||||
}
|
||||
|
||||
void zmq::stream_t::xattach_pipe (pipe_t *pipe_, bool subscribe_to_all_)
|
||||
void zmq::stream_t::xattach_pipe (pipe_t *pipe_,
|
||||
bool subscribe_to_all_,
|
||||
bool locally_initiated_)
|
||||
{
|
||||
LIBZMQ_UNUSED (subscribe_to_all_);
|
||||
|
||||
zmq_assert (pipe_);
|
||||
|
||||
identify_peer (pipe_);
|
||||
identify_peer (pipe_, locally_initiated_);
|
||||
_fq.attach (pipe_);
|
||||
}
|
||||
|
||||
@@ -264,14 +266,14 @@ bool zmq::stream_t::xhas_out ()
|
||||
return true;
|
||||
}
|
||||
|
||||
void zmq::stream_t::identify_peer (pipe_t *pipe_)
|
||||
void zmq::stream_t::identify_peer (pipe_t *pipe_, bool locally_initiated_)
|
||||
{
|
||||
// Always assign routing id for raw-socket
|
||||
unsigned char buffer[5];
|
||||
buffer[0] = 0;
|
||||
blob_t routing_id;
|
||||
const std::string connect_routing_id = extract_connect_routing_id ();
|
||||
if (!connect_routing_id.empty ()) {
|
||||
if (locally_initiated_ && connect_routing_id_is_set ()) {
|
||||
const std::string connect_routing_id = extract_connect_routing_id ();
|
||||
routing_id.set (
|
||||
reinterpret_cast<const unsigned char *> (connect_routing_id.c_str ()),
|
||||
connect_routing_id.length ());
|
||||
|
||||
Reference in New Issue
Block a user