mirror of
https://github.com/zeromq/libzmq.git
synced 2025-01-19 08:46:44 +01:00
Problem: code is unnecessarily imperative
Solution: make more functional-style
This commit is contained in:
parent
bfec30b1e5
commit
47dba21005
@ -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);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user