Commit dc949624 authored by Richard Newton's avatar Richard Newton

Handle infinite hwms properly

parent 15eecf4c
...@@ -520,8 +520,18 @@ void zmq::pipe_t::hiccup () ...@@ -520,8 +520,18 @@ void zmq::pipe_t::hiccup ()
void zmq::pipe_t::set_hwms (int inhwm_, int outhwm_) void zmq::pipe_t::set_hwms (int inhwm_, int outhwm_)
{ {
lwm = compute_lwm(inhwm_ + inhwmboost); int in = inhwm_ + inhwmboost;
hwm = outhwm_ + outhwmboost; 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_) void zmq::pipe_t::set_hwms_boost(int inhwmboost_, int outhwmboost_)
......
...@@ -278,13 +278,13 @@ int main (void) ...@@ -278,13 +278,13 @@ int main (void)
count = test_inproc_connect_first (0, 0); count = test_inproc_connect_first (0, 0);
assert (count == MAX_SENDS); assert (count == MAX_SENDS);
// Infinite send buffer // Infinite receive buffer
count = test_inproc_bind_first (1, 0); count = test_inproc_bind_first (1, 0);
assert (count == MAX_SENDS); assert (count == MAX_SENDS);
count = test_inproc_connect_first (1, 0); count = test_inproc_connect_first (1, 0);
assert (count == MAX_SENDS); assert (count == MAX_SENDS);
// Infinite receive buffer // Infinite send buffer
count = test_inproc_bind_first (0, 1); count = test_inproc_bind_first (0, 1);
assert (count == MAX_SENDS); assert (count == MAX_SENDS);
count = test_inproc_connect_first (0, 1); count = test_inproc_connect_first (0, 1);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment