]> git.proxmox.com Git - mirror_frr.git/commitdiff
lib: cope with negative timeout in thread.c
authorDavid Lamparter <equinox@opensourcerouting.org>
Mon, 23 Jan 2017 17:51:19 +0000 (18:51 +0100)
committerDavid Lamparter <equinox@opensourcerouting.org>
Mon, 23 Jan 2017 17:59:15 +0000 (18:59 +0100)
Since time is no longer cached, if we schedule something with zero
timeout, it will automatically be negative by the time we reach the
event loop.

Signed-off-by: David Lamparter <equinox@opensourcerouting.org>
lib/thread.c

index 406eddc9e60244356a92bdc8d06b8faac40b41dc..de7066bb820164437d34ba1a54b8e5782735dd29 100644 (file)
@@ -1203,6 +1203,12 @@ thread_fetch (struct thread_master *m, struct thread *fetch)
             timer_wait = timer_wait_bg;
         }
 
+      if (timer_wait && timer_wait->tv_sec < 0)
+        {
+          timerclear(&timer_val);
+          timer_wait = &timer_val;
+        }
+
       num = fd_select (m, FD_SETSIZE, &readfd, &writefd, &exceptfd, timer_wait);
       
       /* Signals should get quick treatment */