]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: hlua: Set context's appctx when the lua socket is created
authorChristopher Faulet <cfaulet@haproxy.com>
Wed, 27 Sep 2023 15:17:48 +0000 (17:17 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Wed, 4 Oct 2023 13:33:57 +0000 (15:33 +0200)
The lua socket's context referenced the owning appctx. It was set when the
appctx was initialized. It is now performed when the appctx is created. It
is a small change but this will be required to fix several issues with the
lua sockets.

src/hlua.c

index de32c524e3872e101a8653d77067a670b6dc0399..9e448b81646993860bc6684fd6ca0cb5fbaf4eec 100644 (file)
@@ -2327,7 +2327,6 @@ static void hlua_socket_handler(struct appctx *appctx)
 
 static int hlua_socket_init(struct appctx *appctx)
 {
-       struct hlua_csk_ctx *ctx = appctx->svcctx;
        struct stream *s;
 
        if (appctx_finalize_startup(appctx, socket_proxy, &BUF_NULL) == -1)
@@ -2345,7 +2344,6 @@ static int hlua_socket_init(struct appctx *appctx)
        s->flags |= SF_DIRECT | SF_ASSIGNED | SF_BE_ASSIGNED;
        s->target = &socket_tcp->obj_type;
 
-       ctx->appctx = appctx;
        return 0;
 
   error:
@@ -3337,6 +3335,7 @@ __LJMP static int hlua_socket_new(lua_State *L)
        ctx = applet_reserve_svcctx(appctx, sizeof(*ctx));
        ctx->connected = 0;
        ctx->die = 0;
+       ctx->appctx = appctx;
        LIST_INIT(&ctx->wake_on_write);
        LIST_INIT(&ctx->wake_on_read);