]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[BUG] fix buggy timeout computation in wake_expired_tasks
authorWilly Tarreau <w@1wt.eu>
Mon, 14 May 2007 00:03:47 +0000 (02:03 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 14 May 2007 00:03:47 +0000 (02:03 +0200)
Wake_expired_tasks is supposed to return a date, not an interval. It
was causing busy loops in pollers.

src/task.c

index 41c0b2a2b3a5f2dd2d89b42cb306b1d16055fe85..8d9d10cd0c6765fd959fbc025e9c3e049c99a847 100644 (file)
@@ -96,7 +96,7 @@ void wake_expired_tasks(struct timeval *next)
        if (likely(timer_wq.data != NULL)) {
                task = LIST_ELEM(timer_wq.data, struct task *, qlist);
                if (likely(tv_isgt(&task->expire, &now))) {
-                       tv_remain(&now, &task->expire, next);
+                       *next = task->expire;
                        return;
                }
        }
@@ -108,7 +108,7 @@ void wake_expired_tasks(struct timeval *next)
                task = LIST_ELEM(data, struct task *, qlist);
 
                if (tv_isgt(&task->expire, &now)) {
-                       tv_remain(&now, &task->expire, next);
+                       *next = task->expire;
                        break;
                }