2013-06-27 20:47:34 +02:00
|
|
|
/*
|
2016-01-28 15:07:31 +01:00
|
|
|
Copyright (c) 2007-2016 Contributors as noted in the AUTHORS file
|
2013-06-27 20:47:34 +02:00
|
|
|
|
2015-06-02 22:33:55 +02:00
|
|
|
This file is part of libzmq, the ZeroMQ core engine in C++.
|
2013-06-27 20:47:34 +02:00
|
|
|
|
2015-06-02 22:33:55 +02:00
|
|
|
libzmq is free software; you can redistribute it and/or modify it under
|
|
|
|
the terms of the GNU Lesser General Public License (LGPL) as published
|
|
|
|
by the Free Software Foundation; either version 3 of the License, or
|
2013-06-27 20:47:34 +02:00
|
|
|
(at your option) any later version.
|
|
|
|
|
2015-06-02 22:33:55 +02:00
|
|
|
As a special exception, the Contributors give you permission to link
|
|
|
|
this library with independent modules to produce an executable,
|
|
|
|
regardless of the license terms of these independent modules, and to
|
|
|
|
copy and distribute the resulting executable under terms of your choice,
|
|
|
|
provided that you also meet, for each linked independent module, the
|
|
|
|
terms and conditions of the license of that module. An independent
|
|
|
|
module is a module which is not derived from or based on this library.
|
|
|
|
If you modify this library, you must extend this exception to your
|
|
|
|
version of the library.
|
|
|
|
|
|
|
|
libzmq is distributed in the hope that it will be useful, but WITHOUT
|
|
|
|
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
|
|
FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
|
|
|
|
License for more details.
|
2013-06-27 20:47:34 +02:00
|
|
|
|
|
|
|
You should have received a copy of the GNU Lesser General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
2016-02-18 17:56:52 +01:00
|
|
|
#include "precompiled.hpp"
|
2015-08-22 01:12:22 +02:00
|
|
|
#include "macros.hpp"
|
2013-06-27 20:47:34 +02:00
|
|
|
#include "stream.hpp"
|
|
|
|
#include "pipe.hpp"
|
|
|
|
#include "wire.hpp"
|
|
|
|
#include "random.hpp"
|
|
|
|
#include "likely.hpp"
|
|
|
|
#include "err.hpp"
|
|
|
|
|
|
|
|
zmq::stream_t::stream_t (class ctx_t *parent_, uint32_t tid_, int sid_) :
|
2018-05-29 11:32:33 +02:00
|
|
|
routing_socket_base_t (parent_, tid_, sid_),
|
2018-05-27 11:10:39 +02:00
|
|
|
_prefetched (false),
|
|
|
|
_routing_id_sent (false),
|
|
|
|
_current_out (NULL),
|
|
|
|
_more_out (false),
|
|
|
|
_next_integral_routing_id (generate_random ())
|
2013-06-27 20:47:34 +02:00
|
|
|
{
|
|
|
|
options.type = ZMQ_STREAM;
|
2015-01-23 15:25:40 +01:00
|
|
|
options.raw_socket = true;
|
2013-06-27 20:47:34 +02:00
|
|
|
|
2018-05-27 11:10:39 +02:00
|
|
|
_prefetched_routing_id.init ();
|
|
|
|
_prefetched_msg.init ();
|
2013-06-27 20:47:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
zmq::stream_t::~stream_t ()
|
|
|
|
{
|
2018-05-27 11:10:39 +02:00
|
|
|
_prefetched_routing_id.close ();
|
|
|
|
_prefetched_msg.close ();
|
2013-06-27 20:47:34 +02:00
|
|
|
}
|
|
|
|
|
2018-07-24 20:48:43 +02:00
|
|
|
void zmq::stream_t::xattach_pipe (pipe_t *pipe_,
|
|
|
|
bool subscribe_to_all_,
|
|
|
|
bool locally_initiated_)
|
2013-06-27 20:47:34 +02:00
|
|
|
{
|
2016-09-17 08:44:00 +02:00
|
|
|
LIBZMQ_UNUSED (subscribe_to_all_);
|
2013-06-27 20:47:34 +02:00
|
|
|
|
|
|
|
zmq_assert (pipe_);
|
|
|
|
|
2018-07-24 20:48:43 +02:00
|
|
|
identify_peer (pipe_, locally_initiated_);
|
2018-05-27 11:10:39 +02:00
|
|
|
_fq.attach (pipe_);
|
2013-06-27 20:47:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void zmq::stream_t::xpipe_terminated (pipe_t *pipe_)
|
|
|
|
{
|
2018-05-29 12:20:49 +02:00
|
|
|
erase_out_pipe (pipe_);
|
2018-05-27 11:10:39 +02:00
|
|
|
_fq.pipe_terminated (pipe_);
|
2018-05-29 11:40:40 +02:00
|
|
|
// TODO router_t calls pipe_->rollback() here; should this be done here as
|
|
|
|
// well? then xpipe_terminated could be pulled up to routing_socket_base_t
|
2018-05-27 11:10:39 +02:00
|
|
|
if (pipe_ == _current_out)
|
|
|
|
_current_out = NULL;
|
2013-06-27 20:47:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
void zmq::stream_t::xread_activated (pipe_t *pipe_)
|
|
|
|
{
|
2018-05-27 11:10:39 +02:00
|
|
|
_fq.activated (pipe_);
|
2013-06-27 20:47:34 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
int zmq::stream_t::xsend (msg_t *msg_)
|
|
|
|
{
|
|
|
|
// If this is the first part of the message it's the ID of the
|
|
|
|
// peer to send the message to.
|
2018-05-27 11:10:39 +02:00
|
|
|
if (!_more_out) {
|
|
|
|
zmq_assert (!_current_out);
|
2013-06-27 20:47:34 +02:00
|
|
|
|
|
|
|
// If we have malformed message (prefix with no subsequent message)
|
|
|
|
// then just silently ignore it.
|
|
|
|
// TODO: The connections should be killed instead.
|
|
|
|
if (msg_->flags () & msg_t::more) {
|
2017-09-06 17:45:56 +02:00
|
|
|
// Find the pipe associated with the routing id stored in the prefix.
|
2013-06-27 20:47:34 +02:00
|
|
|
// If there's no such pipe return an error
|
|
|
|
|
2018-05-29 12:54:33 +02:00
|
|
|
out_pipe_t *out_pipe = lookup_out_pipe (
|
|
|
|
blob_t (static_cast<unsigned char *> (msg_->data ()),
|
|
|
|
msg_->size (), reference_tag_t ()));
|
|
|
|
|
|
|
|
if (out_pipe) {
|
|
|
|
_current_out = out_pipe->pipe;
|
2018-05-27 11:10:39 +02:00
|
|
|
if (!_current_out->check_write ()) {
|
2018-05-29 12:54:33 +02:00
|
|
|
out_pipe->active = false;
|
2018-05-27 11:10:39 +02:00
|
|
|
_current_out = NULL;
|
2013-06-27 20:47:34 +02:00
|
|
|
errno = EAGAIN;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
errno = EHOSTUNREACH;
|
|
|
|
return -1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2013-06-28 11:24:14 +02:00
|
|
|
// Expect one more message frame.
|
2018-05-27 11:10:39 +02:00
|
|
|
_more_out = true;
|
2013-06-28 11:24:14 +02:00
|
|
|
|
2013-06-27 20:47:34 +02:00
|
|
|
int rc = msg_->close ();
|
|
|
|
errno_assert (rc == 0);
|
|
|
|
rc = msg_->init ();
|
|
|
|
errno_assert (rc == 0);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2013-06-28 09:08:54 +02:00
|
|
|
// Ignore the MORE flag
|
2013-06-27 20:47:34 +02:00
|
|
|
msg_->reset_flags (msg_t::more);
|
|
|
|
|
2013-06-28 11:24:14 +02:00
|
|
|
// This is the last part of the message.
|
2018-05-27 11:10:39 +02:00
|
|
|
_more_out = false;
|
2013-06-27 20:47:34 +02:00
|
|
|
|
|
|
|
// Push the message into the pipe. If there's no out pipe, just drop it.
|
2018-05-27 11:10:39 +02:00
|
|
|
if (_current_out) {
|
2013-06-27 20:47:34 +02:00
|
|
|
// Close the remote connection if user has asked to do so
|
|
|
|
// by sending zero length message.
|
|
|
|
// Pending messages in the pipe will be dropped (on receiving term- ack)
|
2013-06-28 09:08:54 +02:00
|
|
|
if (msg_->size () == 0) {
|
2018-05-27 11:10:39 +02:00
|
|
|
_current_out->terminate (false);
|
2013-06-27 20:47:34 +02:00
|
|
|
int rc = msg_->close ();
|
|
|
|
errno_assert (rc == 0);
|
2013-10-28 21:00:42 +01:00
|
|
|
rc = msg_->init ();
|
|
|
|
errno_assert (rc == 0);
|
2018-05-27 11:10:39 +02:00
|
|
|
_current_out = NULL;
|
2013-06-27 20:47:34 +02:00
|
|
|
return 0;
|
|
|
|
}
|
2019-12-25 13:51:21 +01:00
|
|
|
const bool ok = _current_out->write (msg_);
|
2013-06-28 11:24:14 +02:00
|
|
|
if (likely (ok))
|
2018-05-27 11:10:39 +02:00
|
|
|
_current_out->flush ();
|
|
|
|
_current_out = NULL;
|
2013-06-27 20:47:34 +02:00
|
|
|
} else {
|
2019-12-25 13:51:21 +01:00
|
|
|
const int rc = msg_->close ();
|
2013-06-27 20:47:34 +02:00
|
|
|
errno_assert (rc == 0);
|
|
|
|
}
|
|
|
|
|
|
|
|
// Detach the message from the data buffer.
|
2019-12-25 13:51:21 +01:00
|
|
|
const int rc = msg_->init ();
|
2013-06-27 20:47:34 +02:00
|
|
|
errno_assert (rc == 0);
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
2014-01-19 09:27:57 +01:00
|
|
|
|
Both STREAM and ROUTER sockets suffer from a naming problem on outbound connections. While these connections can be created, they can't be immediately used. Traffic must be received before it can be sent. This prevents practical, minimal usage of STREAM or ROUTER as a true N fan in/out socket.
This change simply provides the user with a socket option that sets a user defined name of the next outbound connection:
zmq_setsockopt(routerSock,ZMQ_NEXT_IDENTITY,"myname",6);
if(0 > zmq_connect(routerSock,"tcp://127.0.0.1:1234")) return 1;
ret = zmq_send(routerSock,"myname",6,ZMQ_SNDMORE);
zmq_send(routerSock,b.mem,b.used,0);
In this example, the socket is immediately given the name "myname", and is capable of immediately sending traffic.
This approach is more effective in three ways:
1) It prevents all sorts of malicious peer naming attacks that can cause undefined behavior in existing ROUTER connections. (Two connections are made that both transmit the same name to the ROUTER, the ROUTER behavior is undefined)
2) It allows immediate control of connections made to external parties for STREAM sockets. Something that is not possible right now. Before an outbound connection had no name for STREAM or ROUTER sockets because outbound connections cannot be sent to without first receiving traffic.
3) It is simpler and more general than expecting two ROUTER sockets to handshake on assigned connection names. Plus it allows inline sending to new connections on ROUTER.
2014-01-17 23:34:39 +01:00
|
|
|
int zmq::stream_t::xsetsockopt (int option_,
|
|
|
|
const void *optval_,
|
|
|
|
size_t optvallen_)
|
|
|
|
{
|
|
|
|
switch (option_) {
|
2015-01-23 15:25:40 +01:00
|
|
|
case ZMQ_STREAM_NOTIFY:
|
2018-03-06 11:16:22 +01:00
|
|
|
return do_setsockopt_int_as_bool_strict (optval_, optvallen_,
|
|
|
|
&options.raw_notify);
|
2015-01-23 15:25:40 +01:00
|
|
|
|
Both STREAM and ROUTER sockets suffer from a naming problem on outbound connections. While these connections can be created, they can't be immediately used. Traffic must be received before it can be sent. This prevents practical, minimal usage of STREAM or ROUTER as a true N fan in/out socket.
This change simply provides the user with a socket option that sets a user defined name of the next outbound connection:
zmq_setsockopt(routerSock,ZMQ_NEXT_IDENTITY,"myname",6);
if(0 > zmq_connect(routerSock,"tcp://127.0.0.1:1234")) return 1;
ret = zmq_send(routerSock,"myname",6,ZMQ_SNDMORE);
zmq_send(routerSock,b.mem,b.used,0);
In this example, the socket is immediately given the name "myname", and is capable of immediately sending traffic.
This approach is more effective in three ways:
1) It prevents all sorts of malicious peer naming attacks that can cause undefined behavior in existing ROUTER connections. (Two connections are made that both transmit the same name to the ROUTER, the ROUTER behavior is undefined)
2) It allows immediate control of connections made to external parties for STREAM sockets. Something that is not possible right now. Before an outbound connection had no name for STREAM or ROUTER sockets because outbound connections cannot be sent to without first receiving traffic.
3) It is simpler and more general than expecting two ROUTER sockets to handshake on assigned connection names. Plus it allows inline sending to new connections on ROUTER.
2014-01-17 23:34:39 +01:00
|
|
|
default:
|
2018-05-29 11:32:33 +02:00
|
|
|
return routing_socket_base_t::xsetsockopt (option_, optval_,
|
|
|
|
optvallen_);
|
Both STREAM and ROUTER sockets suffer from a naming problem on outbound connections. While these connections can be created, they can't be immediately used. Traffic must be received before it can be sent. This prevents practical, minimal usage of STREAM or ROUTER as a true N fan in/out socket.
This change simply provides the user with a socket option that sets a user defined name of the next outbound connection:
zmq_setsockopt(routerSock,ZMQ_NEXT_IDENTITY,"myname",6);
if(0 > zmq_connect(routerSock,"tcp://127.0.0.1:1234")) return 1;
ret = zmq_send(routerSock,"myname",6,ZMQ_SNDMORE);
zmq_send(routerSock,b.mem,b.used,0);
In this example, the socket is immediately given the name "myname", and is capable of immediately sending traffic.
This approach is more effective in three ways:
1) It prevents all sorts of malicious peer naming attacks that can cause undefined behavior in existing ROUTER connections. (Two connections are made that both transmit the same name to the ROUTER, the ROUTER behavior is undefined)
2) It allows immediate control of connections made to external parties for STREAM sockets. Something that is not possible right now. Before an outbound connection had no name for STREAM or ROUTER sockets because outbound connections cannot be sent to without first receiving traffic.
3) It is simpler and more general than expecting two ROUTER sockets to handshake on assigned connection names. Plus it allows inline sending to new connections on ROUTER.
2014-01-17 23:34:39 +01:00
|
|
|
}
|
|
|
|
}
|
2014-01-19 09:27:57 +01:00
|
|
|
|
2013-06-27 20:47:34 +02:00
|
|
|
int zmq::stream_t::xrecv (msg_t *msg_)
|
|
|
|
{
|
2018-05-27 11:10:39 +02:00
|
|
|
if (_prefetched) {
|
|
|
|
if (!_routing_id_sent) {
|
2019-12-25 13:51:21 +01:00
|
|
|
const int rc = msg_->move (_prefetched_routing_id);
|
2013-06-27 20:47:34 +02:00
|
|
|
errno_assert (rc == 0);
|
2018-05-27 11:10:39 +02:00
|
|
|
_routing_id_sent = true;
|
2013-06-27 20:47:34 +02:00
|
|
|
} else {
|
2019-12-25 13:51:21 +01:00
|
|
|
const int rc = msg_->move (_prefetched_msg);
|
2013-06-27 20:47:34 +02:00
|
|
|
errno_assert (rc == 0);
|
2018-05-27 11:10:39 +02:00
|
|
|
_prefetched = false;
|
2013-06-27 20:47:34 +02:00
|
|
|
}
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
pipe_t *pipe = NULL;
|
2018-05-27 11:10:39 +02:00
|
|
|
int rc = _fq.recvpipe (&_prefetched_msg, &pipe);
|
2013-06-27 20:47:34 +02:00
|
|
|
if (rc != 0)
|
|
|
|
return -1;
|
|
|
|
|
|
|
|
zmq_assert (pipe != NULL);
|
2018-05-27 11:10:39 +02:00
|
|
|
zmq_assert ((_prefetched_msg.flags () & msg_t::more) == 0);
|
2013-06-27 20:47:34 +02:00
|
|
|
|
2013-06-28 11:24:14 +02:00
|
|
|
// We have received a frame with TCP data.
|
2015-09-06 18:46:32 +02:00
|
|
|
// Rather than sending this frame, we keep it in prefetched
|
2013-06-28 11:24:14 +02:00
|
|
|
// buffer and send a frame with peer's ID.
|
2017-10-21 13:19:51 +02:00
|
|
|
const blob_t &routing_id = pipe->get_routing_id ();
|
2015-07-22 04:42:20 +02:00
|
|
|
rc = msg_->close ();
|
|
|
|
errno_assert (rc == 0);
|
2017-09-06 17:45:56 +02:00
|
|
|
rc = msg_->init_size (routing_id.size ());
|
2013-06-28 11:24:14 +02:00
|
|
|
errno_assert (rc == 0);
|
2015-02-18 19:28:58 +01:00
|
|
|
|
|
|
|
// forward metadata (if any)
|
2018-05-27 11:10:39 +02:00
|
|
|
metadata_t *metadata = _prefetched_msg.metadata ();
|
2015-02-18 19:28:58 +01:00
|
|
|
if (metadata)
|
|
|
|
msg_->set_metadata (metadata);
|
|
|
|
|
2017-09-06 17:45:56 +02:00
|
|
|
memcpy (msg_->data (), routing_id.data (), routing_id.size ());
|
2013-06-28 11:24:14 +02:00
|
|
|
msg_->set_flags (msg_t::more);
|
2013-06-27 20:47:34 +02:00
|
|
|
|
2018-05-27 11:10:39 +02:00
|
|
|
_prefetched = true;
|
|
|
|
_routing_id_sent = true;
|
2013-06-27 20:47:34 +02:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool zmq::stream_t::xhas_in ()
|
|
|
|
{
|
|
|
|
// We may already have a message pre-fetched.
|
2018-05-27 11:10:39 +02:00
|
|
|
if (_prefetched)
|
2013-06-27 20:47:34 +02:00
|
|
|
return true;
|
|
|
|
|
|
|
|
// Try to read the next message.
|
|
|
|
// The message, if read, is kept in the pre-fetch buffer.
|
|
|
|
pipe_t *pipe = NULL;
|
2018-05-27 11:10:39 +02:00
|
|
|
int rc = _fq.recvpipe (&_prefetched_msg, &pipe);
|
2013-06-27 20:47:34 +02:00
|
|
|
if (rc != 0)
|
|
|
|
return false;
|
|
|
|
|
|
|
|
zmq_assert (pipe != NULL);
|
2018-05-27 11:10:39 +02:00
|
|
|
zmq_assert ((_prefetched_msg.flags () & msg_t::more) == 0);
|
2013-06-27 20:47:34 +02:00
|
|
|
|
2017-10-21 13:19:51 +02:00
|
|
|
const blob_t &routing_id = pipe->get_routing_id ();
|
2018-05-27 11:10:39 +02:00
|
|
|
rc = _prefetched_routing_id.init_size (routing_id.size ());
|
2013-06-27 20:47:34 +02:00
|
|
|
errno_assert (rc == 0);
|
2015-02-19 20:22:32 +01:00
|
|
|
|
|
|
|
// forward metadata (if any)
|
2018-05-27 11:10:39 +02:00
|
|
|
metadata_t *metadata = _prefetched_msg.metadata ();
|
2015-02-19 20:22:32 +01:00
|
|
|
if (metadata)
|
2018-05-27 11:10:39 +02:00
|
|
|
_prefetched_routing_id.set_metadata (metadata);
|
2015-02-19 20:22:32 +01:00
|
|
|
|
2018-05-27 11:10:39 +02:00
|
|
|
memcpy (_prefetched_routing_id.data (), routing_id.data (),
|
2017-09-06 17:45:56 +02:00
|
|
|
routing_id.size ());
|
2018-05-27 11:10:39 +02:00
|
|
|
_prefetched_routing_id.set_flags (msg_t::more);
|
2013-06-27 20:47:34 +02:00
|
|
|
|
2018-05-27 11:10:39 +02:00
|
|
|
_prefetched = true;
|
|
|
|
_routing_id_sent = false;
|
2013-06-27 20:47:34 +02:00
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool zmq::stream_t::xhas_out ()
|
|
|
|
{
|
2013-06-28 09:08:54 +02:00
|
|
|
// In theory, STREAM socket is always ready for writing. Whether actual
|
2013-06-27 20:47:34 +02:00
|
|
|
// attempt to write succeeds depends on which pipe the message is going
|
|
|
|
// to be routed to.
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
2018-07-24 20:48:43 +02:00
|
|
|
void zmq::stream_t::identify_peer (pipe_t *pipe_, bool locally_initiated_)
|
2013-06-27 20:47:34 +02:00
|
|
|
{
|
2017-09-06 17:45:56 +02:00
|
|
|
// Always assign routing id for raw-socket
|
2013-06-27 20:47:34 +02:00
|
|
|
unsigned char buffer[5];
|
|
|
|
buffer[0] = 0;
|
2017-09-06 17:45:56 +02:00
|
|
|
blob_t routing_id;
|
2018-07-24 20:48:43 +02:00
|
|
|
if (locally_initiated_ && connect_routing_id_is_set ()) {
|
|
|
|
const std::string connect_routing_id = extract_connect_routing_id ();
|
2018-05-29 11:32:33 +02:00
|
|
|
routing_id.set (
|
|
|
|
reinterpret_cast<const unsigned char *> (connect_routing_id.c_str ()),
|
|
|
|
connect_routing_id.length ());
|
|
|
|
// Not allowed to duplicate an existing rid
|
2018-05-29 12:54:33 +02:00
|
|
|
zmq_assert (!has_out_pipe (routing_id));
|
2014-01-18 22:08:06 +01:00
|
|
|
} else {
|
2018-05-27 11:10:39 +02:00
|
|
|
put_uint32 (buffer + 1, _next_integral_routing_id++);
|
2017-10-21 13:19:51 +02:00
|
|
|
routing_id.set (buffer, sizeof buffer);
|
2017-09-06 17:45:56 +02:00
|
|
|
memcpy (options.routing_id, routing_id.data (), routing_id.size ());
|
2018-05-18 15:54:00 +02:00
|
|
|
options.routing_id_size =
|
|
|
|
static_cast<unsigned char> (routing_id.size ());
|
Both STREAM and ROUTER sockets suffer from a naming problem on outbound connections. While these connections can be created, they can't be immediately used. Traffic must be received before it can be sent. This prevents practical, minimal usage of STREAM or ROUTER as a true N fan in/out socket.
This change simply provides the user with a socket option that sets a user defined name of the next outbound connection:
zmq_setsockopt(routerSock,ZMQ_NEXT_IDENTITY,"myname",6);
if(0 > zmq_connect(routerSock,"tcp://127.0.0.1:1234")) return 1;
ret = zmq_send(routerSock,"myname",6,ZMQ_SNDMORE);
zmq_send(routerSock,b.mem,b.used,0);
In this example, the socket is immediately given the name "myname", and is capable of immediately sending traffic.
This approach is more effective in three ways:
1) It prevents all sorts of malicious peer naming attacks that can cause undefined behavior in existing ROUTER connections. (Two connections are made that both transmit the same name to the ROUTER, the ROUTER behavior is undefined)
2) It allows immediate control of connections made to external parties for STREAM sockets. Something that is not possible right now. Before an outbound connection had no name for STREAM or ROUTER sockets because outbound connections cannot be sent to without first receiving traffic.
3) It is simpler and more general than expecting two ROUTER sockets to handshake on assigned connection names. Plus it allows inline sending to new connections on ROUTER.
2014-01-17 23:34:39 +01:00
|
|
|
}
|
2017-09-07 09:29:46 +02:00
|
|
|
pipe_->set_router_socket_routing_id (routing_id);
|
2018-05-29 12:54:33 +02:00
|
|
|
add_out_pipe (ZMQ_MOVE (routing_id), pipe_);
|
2013-06-27 20:47:34 +02:00
|
|
|
}
|