]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
IO: Fix race condition in event processing
authorOndrej Zajicek <santiago@crfreenet.org>
Wed, 4 Oct 2023 15:36:03 +0000 (17:36 +0200)
committerOndrej Zajicek <santiago@crfreenet.org>
Wed, 4 Oct 2023 15:36:03 +0000 (17:36 +0200)
When regular event was added from work event, we did remember that
regular event list was empty and therefore we did not use zero time
in poll(). This leads to ~3 s latency in route reload during
reconfiguration.

sysdep/unix/io.c

index 6aedcfb669191ae60c198d6b3620a9123afc8e9a..4b3eef4862f195d6af59035402e17fd5bb68838e 100644 (file)
@@ -2226,12 +2226,12 @@ io_loop(void)
   for(;;)
     {
       times_update(&main_timeloop);
-      events = ev_run_list(&global_event_list);
-      events = ev_run_list_limited(&global_work_list, WORK_EVENTS_MAX) || events;
+      ev_run_list(&global_event_list);
+      ev_run_list_limited(&global_work_list, WORK_EVENTS_MAX);
       timers_fire(&main_timeloop);
       io_close_event();
 
-      // FIXME
+      events = !EMPTY_LIST(global_event_list) || !EMPTY_LIST(global_work_list);
       poll_tout = (events ? 0 : 3000); /* Time in milliseconds */
       if (t = timers_first(&main_timeloop))
       {