]> git.ipfire.org Git - thirdparty/bird.git/commitdiff
IO: Avoid multiple event cycles in one loop cycle.
authorOndrej Zajicek (work) <santiago@crfreenet.org>
Wed, 6 Apr 2016 09:57:28 +0000 (11:57 +0200)
committerPavel Tvrdik <pawel.tvrdik@gmail.com>
Tue, 3 May 2016 07:25:37 +0000 (09:25 +0200)
Event cycle may took too much time and trigger next timer events, so
avoid cycling between timer and event cycles inside the loop cycle.

proto/bgp/bgp.c
sysdep/unix/io.c

index 5841e5bd3b29f24581718137089612099e016a6f..b6751977d401647dadd849b9a017515347e76380 100644 (file)
@@ -670,6 +670,10 @@ bgp_keepalive_timeout(timer *t)
 
   DBG("BGP: Keepalive timer\n");
   bgp_schedule_packet(conn, PKT_KEEPALIVE);
+
+  /* Kick TX a bit faster */
+  if (ev_active(conn->tx_ev))
+    ev_run(conn->tx_ev);
 }
 
 static void
index a747580db89631cc8b760e2e2a38c9d3b5e21bc7..297953346c0fbe909579ff02b47be2d041aba49d 100644 (file)
@@ -2050,12 +2050,13 @@ io_loop(void)
   for(;;)
     {
       events = ev_run_list(&global_event_list);
+    timers:
       update_times();
       tout = tm_first_shot();
       if (tout <= now)
        {
          tm_shot();
-         continue;
+         goto timers;
        }
       poll_tout = (events ? 0 : MIN(tout - now, 3)) * 1000; /* Time in milliseconds */