Fix check for expired events.
authorGuus Sliepen <guus@tinc-vpn.org>
Thu, 29 Nov 2012 13:32:12 +0000 (14:32 +0100)
committerGuus Sliepen <guus@tinc-vpn.org>
Thu, 29 Nov 2012 13:32:12 +0000 (14:32 +0100)
This would trigger a infinite loop if a timeout expired and the next timeout
was not expired yet, but less than 1 second from being expired.

src/event.c

index 71213bcc01133226c48f5b4da77e9be230553fa4..fdbf11d151bcb2e73d484d2ca790f749790cd6c6 100644 (file)
@@ -182,7 +182,7 @@ bool event_loop(void) {
                        timeout_t *timeout = timeout_tree.head->data;
                        timersub(&timeout->tv, &now, &diff);
 
-                       if(diff.tv_sec <= 0) {
+                       if(diff.tv_sec < 0) {
                                timeout->cb(timeout->data);
                                if(timercmp(&timeout->tv, &now, <))
                                        timeout_del(timeout);