From bd1f1325e135971b367c1096b92953b0bb5852dc Mon Sep 17 00:00:00 2001 From: Thierry FOURNIER Date: Thu, 5 Mar 2015 17:04:41 +0100 Subject: [PATCH] MINOR: lua: add the struct session in the lua channel struct This is used later to modify some flags in the session. --- include/types/hlua.h | 1 + src/hlua.c | 7 ++++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/include/types/hlua.h b/include/types/hlua.h index 58402f43bc..b1d99f4c3d 100644 --- a/include/types/hlua.h +++ b/include/types/hlua.h @@ -121,6 +121,7 @@ struct hlua_socket { */ struct hlua_channel { struct channel *chn; + struct session *s; }; #else /* USE_LUA */ diff --git a/src/hlua.c b/src/hlua.c index 4570bc94c0..073c4086a2 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -1965,7 +1965,7 @@ __LJMP static struct hlua_channel *hlua_checkchannel(lua_State *L, int ud) * If the stask does not have a free slots, the function fails * and returns 0; */ -static int hlua_channel_new(lua_State *L, struct channel *channel) +static int hlua_channel_new(lua_State *L, struct session *s, struct channel *channel) { struct hlua_channel *chn; @@ -1978,6 +1978,7 @@ static int hlua_channel_new(lua_State *L, struct channel *channel) */ chn = lua_newuserdata(L, sizeof(*chn)); chn->chn = channel; + chn->s = s; /* Pop a class sesison metatable and affect it to the userdata. */ lua_rawgeti(L, LUA_REGISTRYINDEX, class_channel_ref); @@ -2412,7 +2413,7 @@ __LJMP static int hlua_txn_req_channel(lua_State *L) MAY_LJMP(check_args(L, 1, "req_channel")); s = MAY_LJMP(hlua_checktxn(L, 1)); - if (!hlua_channel_new(L, s->s->req)) + if (!hlua_channel_new(L, s->s, s->s->req)) WILL_LJMP(luaL_error(L, "full stack")); return 1; @@ -2429,7 +2430,7 @@ __LJMP static int hlua_txn_res_channel(lua_State *L) MAY_LJMP(check_args(L, 1, "req_channel")); s = MAY_LJMP(hlua_checktxn(L, 1)); - if (!hlua_channel_new(L, s->s->rep)) + if (!hlua_channel_new(L, s->s, s->s->rep)) WILL_LJMP(luaL_error(L, "full stack")); return 1; -- 2.39.5