mirror of
https://github.com/zeromq/libzmq.git
synced 2024-12-14 11:06:59 +01:00
Problem: HWM always boosted by 1
Solution: initialise *hwmboost to -1 instead of 1, and use it only if it's >= 0. The socket option code checks anyway that the user-provided value is >= 0 so there is no risk of clashing. The documentation also specifies that it has to be >= 0.
This commit is contained in:
parent
9f1ba60f50
commit
edc770d680
12
src/pipe.cpp
12
src/pipe.cpp
@ -83,8 +83,8 @@ zmq::pipe_t::pipe_t (object_t *parent_, upipe_t *inpipe_, upipe_t *outpipe_,
|
||||
out_active (true),
|
||||
hwm (outhwm_),
|
||||
lwm (compute_lwm (inhwm_)),
|
||||
inhwmboost(1),
|
||||
outhwmboost(1),
|
||||
inhwmboost(-1),
|
||||
outhwmboost(-1),
|
||||
msgs_read (0),
|
||||
msgs_written (0),
|
||||
peers_msgs_read (0),
|
||||
@ -508,14 +508,14 @@ void zmq::pipe_t::hiccup ()
|
||||
|
||||
void zmq::pipe_t::set_hwms (int inhwm_, int outhwm_)
|
||||
{
|
||||
int in = inhwm_ + inhwmboost;
|
||||
int out = outhwm_ + outhwmboost;
|
||||
int in = inhwm_ + (inhwmboost > 0 ? inhwmboost : 0);
|
||||
int out = outhwm_ + (outhwmboost > 0 ? outhwmboost : 0);
|
||||
|
||||
// if either send or recv side has hwm <= 0 it means infinite so we should set hwms infinite
|
||||
if (inhwm_ <= 0 || inhwmboost <= 0)
|
||||
if (inhwm_ <= 0 || inhwmboost == 0)
|
||||
in = 0;
|
||||
|
||||
if (outhwm_ <= 0 || outhwmboost <= 0)
|
||||
if (outhwm_ <= 0 || outhwmboost == 0)
|
||||
out = 0;
|
||||
|
||||
lwm = compute_lwm(in);
|
||||
|
Loading…
Reference in New Issue
Block a user