mirror of
https://github.com/haproxy/haproxy.git
synced 2026-04-15 21:59:41 -04:00
BUG/MEDIUM: lua: fix wakeup condition from sleep()
A time comparison was wrong in hlua_sleep_yield(), making the sleep()
code do nothing for periods of 24 days every 49 days. An arithmetic
comparison was performed on now_ms instead of using tick_is_expired().
This bug was added in 1.6-dev by commit 5b8608f1e ("MINOR: lua: core:
add sleep functions") so the fix should be backported to all stable
versions.
This commit is contained in:
parent
8d264387c3
commit
12c02701d3
1 changed files with 1 additions and 1 deletions
|
|
@ -8052,7 +8052,7 @@ __LJMP static int hlua_log_alert(lua_State *L)
|
|||
__LJMP static int hlua_sleep_yield(lua_State *L, int status, lua_KContext ctx)
|
||||
{
|
||||
int wakeup_ms = lua_tointeger(L, -1);
|
||||
if (now_ms < wakeup_ms)
|
||||
if (!tick_is_expired(wakeup_ms, now_ms))
|
||||
MAY_LJMP(hlua_yieldk(L, 0, 0, hlua_sleep_yield, wakeup_ms, 0));
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue