Commit f448af94 authored by Constantin Rack's avatar Constantin Rack

Merge pull request #1255 from klaussfreire/master

Fix busy-polling when reaching the rate limit
parents fca34e5e 6a227b2e
......@@ -197,6 +197,7 @@ void zmq::pgm_sender_t::out_event ()
if (has_tx_timer) {
cancel_timer (tx_timer_id);
set_pollout (handle);
has_tx_timer = false;
}
......@@ -210,8 +211,10 @@ void zmq::pgm_sender_t::out_event ()
zmq_assert (nbytes == 0);
if (errno == ENOMEM) {
// Stop polling handle and wait for tx timeout
const long timeout = pgm_socket.get_tx_timeout ();
add_timer (timeout, tx_timer_id);
reset_pollout (handle);
has_tx_timer = true;
}
else
......@@ -228,7 +231,9 @@ void zmq::pgm_sender_t::timer_event (int token)
}
else
if (token == tx_timer_id) {
// Restart polling handle and retry sending
has_tx_timer = false;
set_pollout (handle);
out_event ();
}
else
......
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