mirror of
https://github.com/zeromq/libzmq.git
synced 2025-03-04 07:27:26 +01:00
Handle infinite hwms properly
This commit is contained in:
parent
15eecf4cf4
commit
dc949624e1
14
src/pipe.cpp
14
src/pipe.cpp
@ -520,8 +520,18 @@ void zmq::pipe_t::hiccup ()
|
||||
|
||||
void zmq::pipe_t::set_hwms (int inhwm_, int outhwm_)
|
||||
{
|
||||
lwm = compute_lwm(inhwm_ + inhwmboost);
|
||||
hwm = outhwm_ + outhwmboost;
|
||||
int in = inhwm_ + inhwmboost;
|
||||
int out = outhwm_ + outhwmboost;
|
||||
|
||||
// if either send or recv side has hwm <= 0 it means infinite so we should set hwms infinite
|
||||
if (inhwm_ <= 0 || inhwmboost <= 0)
|
||||
in = 0;
|
||||
|
||||
if (outhwm_ <= 0 || outhwmboost <= 0)
|
||||
out = 0;
|
||||
|
||||
lwm = compute_lwm(in);
|
||||
hwm = out;
|
||||
}
|
||||
|
||||
void zmq::pipe_t::set_hwms_boost(int inhwmboost_, int outhwmboost_)
|
||||
|
@ -278,13 +278,13 @@ int main (void)
|
||||
count = test_inproc_connect_first (0, 0);
|
||||
assert (count == MAX_SENDS);
|
||||
|
||||
// Infinite send buffer
|
||||
// Infinite receive buffer
|
||||
count = test_inproc_bind_first (1, 0);
|
||||
assert (count == MAX_SENDS);
|
||||
count = test_inproc_connect_first (1, 0);
|
||||
assert (count == MAX_SENDS);
|
||||
|
||||
// Infinite receive buffer
|
||||
// Infinite send buffer
|
||||
count = test_inproc_bind_first (0, 1);
|
||||
assert (count == MAX_SENDS);
|
||||
count = test_inproc_connect_first (0, 1);
|
||||
|
Loading…
x
Reference in New Issue
Block a user