]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[BUG] ev_kqueue was forgotten during the switch to timeval
authorWilly Tarreau <w@1wt.eu>
Mon, 14 May 2007 01:15:46 +0000 (03:15 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 14 May 2007 01:15:46 +0000 (03:15 +0200)
src/ev_kqueue.c

index 55419f6f02b3e385b62cacef894516c0bf510cbf..8740217b854e945e9e763e08dbd07fe97fb8766b 100644 (file)
@@ -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;
        }