MINOR: lua: add the struct session in the lua channel struct

This is used later to modify some flags in the session.
This commit is contained in:
Thierry FOURNIER 2015-03-05 17:04:41 +01:00 committed by Willy Tarreau
parent 90da191345
commit bd1f1325e1
2 changed files with 5 additions and 3 deletions

View File

@ -121,6 +121,7 @@ struct hlua_socket {
*/
struct hlua_channel {
struct channel *chn;
struct session *s;
};
#else /* USE_LUA */

View File

@ -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;