]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MAJOR: lua: applets can't sleep.
authorThierry Fournier <tfournier@arpalert.org>
Sat, 20 Feb 2016 16:47:43 +0000 (17:47 +0100)
committerWilly Tarreau <w@1wt.eu>
Sat, 20 Feb 2016 17:55:33 +0000 (18:55 +0100)
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

index f1c937afa264438daf98887caedbd10ce9bf9172..fe58b9d0b332d3a3eb0f211fcfe83353fc385411 100644 (file)
@@ -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. */