]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: lua-thread: hlua_ctx_renew() is never called with main gL lua state
authorThierry Fournier <thierry.fournier@ozon.io>
Sat, 28 Nov 2020 10:15:14 +0000 (11:15 +0100)
committerWilly Tarreau <w@1wt.eu>
Wed, 2 Dec 2020 20:53:16 +0000 (21:53 +0100)
The goal is no longer using "struct hlua" with global main lua_state.

if somewhere in the code, hlua_ctx_renew() is called with a global Lua
context, we have a serious bug. A crash is better than working with
this bug, so this patch remove a useless control.

In other way, this control were used during hlua_post_init() function.
The function hlua_post_init() used a call to the runtime hlua_ctx_resume()
function. This call no longer exists.

src/hlua.c

index ec7518176e8274b50e868d4398f7eb978bc98346..6530a39cfab1076677ce3a87657e922b1d4c6a9e 100644 (file)
@@ -1086,10 +1086,6 @@ static int hlua_ctx_renew(struct hlua *lua, int keep_msg)
        lua_State *T;
        int new_ref;
 
-       /* Renew the main LUA stack doesn't have sense. */
-       if (lua == &gL)
-               return 0;
-
        /* New Lua coroutine. */
        T = lua_newthread(gL.T);
        if (!T)