From: Willy Tarreau Date: Mon, 14 May 2007 00:03:47 +0000 (+0200) Subject: [BUG] fix buggy timeout computation in wake_expired_tasks X-Git-Tag: v1.3.11~3 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=fbfc053e34173651e35daa7a605a0a187c4d9609;p=thirdparty%2Fhaproxy.git [BUG] fix buggy timeout computation in wake_expired_tasks Wake_expired_tasks is supposed to return a date, not an interval. It was causing busy loops in pollers. --- diff --git a/src/task.c b/src/task.c index 41c0b2a2b3..8d9d10cd0c 100644 --- a/src/task.c +++ b/src/task.c @@ -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; }