]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
[BUG] wqueue: perform proper timeout comparisons with wrapping values
authorWilly Tarreau <w@1wt.eu>
Sun, 29 Jun 2008 08:25:57 +0000 (10:25 +0200)
committerWilly Tarreau <w@1wt.eu>
Sun, 29 Jun 2008 08:32:02 +0000 (10:32 +0200)
With wrapping keys, we cannot simply do "if (key > now)", but
we must at least do "if ((signed)(key-now) > 0)".

src/task.c

index 16eea645be9e3f8ac0a265cddecaaa9939760848..2c9e0d7a82432e1ce53330f0a05bf3c3e9fdc76b 100644 (file)
@@ -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;