MAJOR: poll: only rely on wake_expired_tasks() to compute the wait delay
Actually, HAProxy uses the function "process_runnable_tasks" and
"wake_expired_tasks" to get the next task which can expires.
If a task is added with "task_schedule" or other method during
the execution of an other task, the expiration of this new task
is not taken into account, and the execution of this task can be
too late.
Actualy, HAProxy seems to be no sensitive to this bug.
This fix moves the call to process_runnable_tasks() before the timeout
calculation and ensures that all wakeups are processed together. Only
wake_expired_tasks() needs to return a timeout now.
diff --git a/include/proto/task.h b/include/proto/task.h
index 76f77c8..107c961 100644
--- a/include/proto/task.h
+++ b/include/proto/task.h
@@ -259,13 +259,13 @@
* - return the date of next event in <next> or eternity.
*/
-void process_runnable_tasks(int *next);
+void process_runnable_tasks();
/*
* Extract all expired timers from the timer queue, and wakes up all
* associated tasks. Returns the date of next event (or eternity).
*/
-void wake_expired_tasks(int *next);
+int wake_expired_tasks();
/* Perform minimal initializations, report 0 in case of error, 1 if OK. */
int init_task();