From: Willy Tarreau Date: Sun, 29 Jun 2008 08:25:57 +0000 (+0200) Subject: [BUG] wqueue: perform proper timeout comparisons with wrapping values X-Git-Tag: v1.3.16-rc1~251 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e62bdd40268d8f268e694cace998537f4cc0f508;p=thirdparty%2Fhaproxy.git [BUG] wqueue: perform proper timeout comparisons with wrapping values With wrapping keys, we cannot simply do "if (key > now)", but we must at least do "if ((signed)(key-now) > 0)". --- diff --git a/src/task.c b/src/task.c index 16eea645be..2c9e0d7a82 100644 --- a/src/task.c +++ b/src/task.c @@ -148,7 +148,7 @@ void wake_expired_tasks(struct timeval *next) struct eb32_node *next_eb; task = eb32_entry(eb, struct task, eb); - if (eb->key > now_key) { + if ((signed)(eb->key - now_key) > 0) { *next = task->expire; timers.first = task->expire; return;