Problem: set hwm after connect lead to infinite hwm

This commit is contained in:
laplaceyang 2017-01-09 12:34:40 +08:00
parent 77e1792cd8
commit 5adcb83509
3 changed files with 11 additions and 2 deletions

View File

@ -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(0),
outhwmboost(0),
inhwmboost(1),
outhwmboost(1),
msgs_read (0),
msgs_written (0),
peers_msgs_read (0),
@ -522,6 +522,11 @@ void zmq::pipe_t::set_hwms (int inhwm_, int outhwm_)
hwm = out;
}
void zmq::pipe_t::set_peer_hwms (int inhwm_, int outhwm_)
{
peer->set_hwms(inhwm_, outhwm_);
}
void zmq::pipe_t::set_hwms_boost(int inhwmboost_, int outhwmboost_)
{
inhwmboost = inhwmboost_;

View File

@ -133,6 +133,9 @@ namespace zmq
// Set the high water marks.
void set_hwms (int inhwm_, int outhwm_);
// Set the high water marks for peer.
void set_peer_hwms (int inhwm_, int outhwm_);
// Set the boost to high water marks, used by inproc sockets so total hwm are sum of connect and bind sockets watermarks
void set_hwms_boost(int inhwmboost_, int outhwmboost_);

View File

@ -1414,6 +1414,7 @@ void zmq::socket_base_t::update_pipe_options(int option_)
for (pipes_t::size_type i = 0; i != pipes.size(); ++i)
{
pipes[i]->set_hwms(options.rcvhwm, options.sndhwm);
pipes[i]->set_peer_hwms(options.sndhwm, options.rcvhwm);
}
}