diff options
author | Jacob Gilbert <mrjacobagilbert@gmail.com> | 2020-04-10 18:54:14 -0600 |
---|---|---|
committer | Marcus Müller <marcus@hostalia.de> | 2020-04-10 21:45:25 +0200 |
commit | c17b2dabf050698532ab38c5460d44bab853ee76 (patch) | |
tree | 62937133ba1ecaf8769d4cb6b86195a16b87379e /gr-zeromq/lib/push_msg_sink_impl.cc | |
parent | daf936e44c85a36e76663f4bb82c6a8756e13812 (diff) |
zeromq: Add bind argument for message based zeromq blocks.
This is needed to support N:1 patterns. To avoid confusion, since this
is probably a feature only needed by those who Know What They Are Doing,
the option is added to the Advanced block property tab.
Diffstat (limited to 'gr-zeromq/lib/push_msg_sink_impl.cc')
-rw-r--r-- | gr-zeromq/lib/push_msg_sink_impl.cc | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/gr-zeromq/lib/push_msg_sink_impl.cc b/gr-zeromq/lib/push_msg_sink_impl.cc index a194c03b80..b9964ce6ab 100644 --- a/gr-zeromq/lib/push_msg_sink_impl.cc +++ b/gr-zeromq/lib/push_msg_sink_impl.cc @@ -19,12 +19,12 @@ namespace gr { namespace zeromq { -push_msg_sink::sptr push_msg_sink::make(char* address, int timeout) +push_msg_sink::sptr push_msg_sink::make(char* address, int timeout, bool bind) { - return gnuradio::get_initial_sptr(new push_msg_sink_impl(address, timeout)); + return gnuradio::get_initial_sptr(new push_msg_sink_impl(address, timeout, bind)); } -push_msg_sink_impl::push_msg_sink_impl(char* address, int timeout) +push_msg_sink_impl::push_msg_sink_impl(char* address, int timeout, bool bind) : gr::block("push_msg_sink", gr::io_signature::make(0, 0, 0), gr::io_signature::make(0, 0, 0)), @@ -42,7 +42,12 @@ push_msg_sink_impl::push_msg_sink_impl(char* address, int timeout) int time = 0; d_socket->setsockopt(ZMQ_LINGER, &time, sizeof(time)); - d_socket->bind(address); + + if (bind) { + d_socket->bind(address); + } else { + d_socket->connect(address); + } message_port_register_in(pmt::mp("in")); set_msg_handler(pmt::mp("in"), boost::bind(&push_msg_sink_impl::handler, this, _1)); |