From: Guus Sliepen Date: Thu, 29 Nov 2012 11:37:04 +0000 (+0100) Subject: Allow multiple timeouts to expire at the exact same time. X-Git-Tag: release-1.1pre4~13 X-Git-Url: https://www.tinc-vpn.org/git/browse?p=tinc;a=commitdiff_plain;h=8825cddd0d8ed6dad00924ef382139da51ca3fc4 Allow multiple timeouts to expire at the exact same time. --- diff --git a/src/event.c b/src/event.c index 6827dc04..71213bcc 100644 --- a/src/event.c +++ b/src/event.c @@ -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) {