make udp support for radio-dish

This commit is contained in:
somdoron
2016-01-29 21:17:11 +02:00
parent a2b9d826e4
commit 5ebfd1728f
14 changed files with 744 additions and 8 deletions

View File

@@ -42,6 +42,7 @@
#include "pgm_receiver.hpp"
#include "address.hpp"
#include "norm_engine.hpp"
#include "udp_engine.hpp"
#include "ctx.hpp"
#include "req.hpp"
@@ -498,7 +499,7 @@ void zmq::session_base_t::reconnect ()
// and reestablish later on
if (pipe && options.immediate == 1
&& addr->protocol != "pgm" && addr->protocol != "epgm"
&& addr->protocol != "norm") {
&& addr->protocol != "norm" && addr->protocol != "udp") {
pipe->hiccup ();
pipe->terminate (false);
terminating_pipes.insert (pipe);
@@ -567,6 +568,32 @@ void zmq::session_base_t::start_connecting (bool wait_)
}
#endif
if (addr->protocol == "udp") {
zmq_assert (options.type == ZMQ_DISH || options.type == ZMQ_RADIO);
udp_engine_t* engine = new (std::nothrow) udp_engine_t ();
alloc_assert (engine);
bool recv = false;
bool send = false;
if (options.type == ZMQ_RADIO) {
send = true;
recv = false;
}
else if (options.type == ZMQ_DISH) {
send = false;
recv = true;
}
int rc = engine->init (addr, send, recv);
errno_assert (rc == 0);
send_attach (this, engine);
return;
}
#ifdef ZMQ_HAVE_OPENPGM
// Both PGM and EPGM transports are using the same infrastructure.