diff --git a/src/socket_base.cpp b/src/socket_base.cpp index 5a6c2655..03393e25 100644 --- a/src/socket_base.cpp +++ b/src/socket_base.cpp @@ -688,16 +688,16 @@ int zmq::socket_base_t::connect (const char *addr_) // The total HWM for an inproc connection should be the sum of // the binder's HWM and the connector's HWM. - int sndhwm = 0; - if (peer.socket == NULL) - sndhwm = options.sndhwm; - else if (options.sndhwm != 0 && peer.options.rcvhwm != 0) - sndhwm = options.sndhwm + peer.options.rcvhwm; - int rcvhwm = 0; - if (peer.socket == NULL) - rcvhwm = options.rcvhwm; - else if (options.rcvhwm != 0 && peer.options.sndhwm != 0) - rcvhwm = options.rcvhwm + peer.options.sndhwm; + const int sndhwm = peer.socket == NULL + ? options.sndhwm + : options.sndhwm != 0 && peer.options.rcvhwm != 0 + ? options.sndhwm + peer.options.rcvhwm + : 0; + const int rcvhwm = peer.socket == NULL + ? options.rcvhwm + : options.rcvhwm != 0 && peer.options.sndhwm != 0 + ? options.rcvhwm + peer.options.sndhwm + : 0; // Create a bi-directional pipe to connect the peers. object_t *parents[2] = {this, peer.socket == NULL ? this : peer.socket};