From: Willy Tarreau Date: Mon, 14 May 2007 01:15:46 +0000 (+0200) Subject: [BUG] ev_kqueue was forgotten during the switch to timeval X-Git-Tag: v1.3.11.1~2 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=79b8a62ff6ca725eeab503265f00b938a66b8096;p=thirdparty%2Fhaproxy.git [BUG] ev_kqueue was forgotten during the switch to timeval --- diff --git a/src/ev_kqueue.c b/src/ev_kqueue.c index 55419f6f02..8740217b85 100644 --- a/src/ev_kqueue.c +++ b/src/ev_kqueue.c @@ -98,16 +98,23 @@ REGPRM1 static void __fd_clo(int fd) /* * kqueue() poller */ -REGPRM2 static void _do_poll(struct poller *p, int wait_time) +REGPRM2 static void _do_poll(struct poller *p, struct timeval *exp) { int status; int count, fd; struct timespec timeout, *to_ptr; to_ptr = NULL; // no timeout - if (wait_time >= 0) { - timeout.tv_sec = wait_time / 1000; - timeout.tv_nsec = (wait_time % 1000) * 1000000; + if (tv_isset(exp)) { + struct timeval delta; + + if (tv_isge(&now, exp)) + delta.tv_sec = delta.tv_usec = 0; + else + tv_remain(&now, exp, &delta); + + timeout.tv_sec = delta.tv_sec; + timeout.tv_nsec = delta.tv_usec * 1000; to_ptr = &timeout; }