Problem: code is unnecessarily imperative

Solution: make more functional-style
This commit is contained in:
Simon Giesecke 2019-03-24 13:46:15 -04:00
parent bfec30b1e5
commit 47dba21005

View File

@ -751,19 +751,8 @@ void zmq::session_base_t::start_connecting_udp (io_thread_t * /*io_thread_*/)
udp_engine_t *engine = new (std::nothrow) udp_engine_t (options); udp_engine_t *engine = new (std::nothrow) udp_engine_t (options);
alloc_assert (engine); alloc_assert (engine);
bool recv = false; const bool recv = options.type == ZMQ_DISH || options.type == ZMQ_DGRAM;
bool send = false; const bool send = options.type == ZMQ_RADIO || options.type == ZMQ_DGRAM;
if (options.type == ZMQ_RADIO) {
send = true;
recv = false;
} else if (options.type == ZMQ_DISH) {
send = false;
recv = true;
} else if (options.type == ZMQ_DGRAM) {
send = true;
recv = true;
}
const int rc = engine->init (_addr, send, recv); const int rc = engine->init (_addr, send, recv);
errno_assert (rc == 0); errno_assert (rc == 0);