X-Git-Url: https://www.tinc-vpn.org/git/browse?a=blobdiff_plain;f=src%2Fevent.c;h=33d205a96f52c1e58b8e1f42150c11ad6633b0a6;hb=e8a60109fc91a42420ec626b63956771675f89b0;hp=5edd3a6d0b7cf8efbef2100ba43012085ac5639d;hpb=f6e87ab476a0faf8b124ecaaa27f967d825e6457;p=tinc diff --git a/src/event.c b/src/event.c index 5edd3a6d..33d205a9 100644 --- a/src/event.c +++ b/src/event.c @@ -41,7 +41,16 @@ static int io_compare(const io_t *a, const io_t *b) { #ifndef HAVE_MINGW return a->fd - b->fd; #else - return a->event - b->event; + + if(a->event < b->event) { + return -1; + } + + if(a->event > b->event) { + return 1; + } + + return 0; #endif } @@ -291,11 +300,9 @@ static struct timeval *get_time_remaining(struct timeval *diff) { timersub(&timeout->tv, &now, diff); if(diff->tv_sec < 0) { - timeout->cb(timeout->data); - - if(timercmp(&timeout->tv, &now, <)) { - timeout_del(timeout); - } + timeout_cb_t cb = timeout->cb; + timeout_del(timeout); + cb(timeout->data); } else { tv = diff; break;