From 0164f200ab75c51a55e097a5a2175f0168ea61a0 Mon Sep 17 00:00:00 2001 From: Thierry Fournier Date: Sat, 20 Feb 2016 17:47:43 +0100 Subject: [PATCH] BUG/MAJOR: lua: applets can't sleep. This patch must be backported in 1.6 hlua_yield() function returns the required sleep time. The Lua core must be resume the execution after the required time. The core dedicated to the http and tcp applet doesn't implement the wake up function. It is a miss. This patch fix this. --- src/hlua.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/hlua.c b/src/hlua.c index f1c937afa..fe58b9d0b 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -5747,6 +5747,8 @@ static void hlua_applet_tcp_fct(struct appctx *ctx) /* yield. */ case HLUA_E_AGAIN: + if (hlua->wake_time != TICK_ETERNITY) + task_schedule(ctx->ctx.hlua_apptcp.task, hlua->wake_time); return; /* finished with error. */ @@ -5970,6 +5972,8 @@ static void hlua_applet_http_fct(struct appctx *ctx) /* yield. */ case HLUA_E_AGAIN: + if (hlua->wake_time != TICK_ETERNITY) + task_schedule(ctx->ctx.hlua_apphttp.task, hlua->wake_time); return; /* finished with error. */