mirror of
https://gitlab.nic.cz/labs/bird.git
synced 2025-01-09 18:41:55 +00:00
IO: Avoid multiple event cycles in one loop cycle.
Event cycle may took too much time and trigger next timer events, so avoid cycling between timer and event cycles inside the loop cycle.
This commit is contained in:
parent
4fa4e9400e
commit
e8de85843d
@ -670,6 +670,10 @@ bgp_keepalive_timeout(timer *t)
|
|||||||
|
|
||||||
DBG("BGP: Keepalive timer\n");
|
DBG("BGP: Keepalive timer\n");
|
||||||
bgp_schedule_packet(conn, PKT_KEEPALIVE);
|
bgp_schedule_packet(conn, PKT_KEEPALIVE);
|
||||||
|
|
||||||
|
/* Kick TX a bit faster */
|
||||||
|
if (ev_active(conn->tx_ev))
|
||||||
|
ev_run(conn->tx_ev);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -2050,12 +2050,13 @@ io_loop(void)
|
|||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
events = ev_run_list(&global_event_list);
|
events = ev_run_list(&global_event_list);
|
||||||
|
timers:
|
||||||
update_times();
|
update_times();
|
||||||
tout = tm_first_shot();
|
tout = tm_first_shot();
|
||||||
if (tout <= now)
|
if (tout <= now)
|
||||||
{
|
{
|
||||||
tm_shot();
|
tm_shot();
|
||||||
continue;
|
goto timers;
|
||||||
}
|
}
|
||||||
poll_tout = (events ? 0 : MIN(tout - now, 3)) * 1000; /* Time in milliseconds */
|
poll_tout = (events ? 0 : MIN(tout - now, 3)) * 1000; /* Time in milliseconds */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user