]> git.meshlink.io Git - meshlink/commitdiff
Allow multiple timeouts to expire at the exact same time.
authorGuus Sliepen <guus@tinc-vpn.org>
Thu, 29 Nov 2012 11:37:04 +0000 (12:37 +0100)
committerGuus Sliepen <guus@tinc-vpn.org>
Thu, 29 Nov 2012 11:37:04 +0000 (12:37 +0100)
src/event.c

index 6827dc048c4b6135a1fa42fbabd1bce63af22406..71213bcc01133226c48f5b4da77e9be230553fa4 100644 (file)
@@ -36,7 +36,7 @@ static int io_compare(const io_t *a, const io_t *b) {
 static int timeout_compare(const timeout_t *a, const timeout_t *b) {
        struct timeval diff;
        timersub(&a->tv, &b->tv, &diff);
-       return diff.tv_sec ?: diff.tv_usec;
+       return diff.tv_sec ?: diff.tv_usec ?: a < b ? -1 : a > b ? 1 : 0;
 }
 
 static int signal_compare(const signal_t *a, const signal_t *b) {