]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: lua: add the struct session in the lua channel struct
authorThierry FOURNIER <tfournier@exceliance.fr>
Thu, 5 Mar 2015 16:04:41 +0000 (17:04 +0100)
committerWilly Tarreau <w@1wt.eu>
Mon, 9 Mar 2015 16:47:52 +0000 (17:47 +0100)
This is used later to modify some flags in the session.

include/types/hlua.h
src/hlua.c

index 58402f43bc296dfdfdd5105060b9d2090a635553..b1d99f4c3deb67fd62ec4f3d0be603de625bc93b 100644 (file)
@@ -121,6 +121,7 @@ struct hlua_socket {
  */
 struct hlua_channel {
        struct channel *chn;
+       struct session *s;
 };
 
 #else /* USE_LUA */
index 4570bc94c0f6fae6ad98e3e3dc67ad8686051b62..073c4086a29d336a451a6e04329a74b13d15c283 100644 (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;