mirror of
https://git.haproxy.org/git/haproxy.git/
synced 2025-09-22 22:31:28 +02:00
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:
parent
90da191345
commit
bd1f1325e1
@ -121,6 +121,7 @@ struct hlua_socket {
|
|||||||
*/
|
*/
|
||||||
struct hlua_channel {
|
struct hlua_channel {
|
||||||
struct channel *chn;
|
struct channel *chn;
|
||||||
|
struct session *s;
|
||||||
};
|
};
|
||||||
|
|
||||||
#else /* USE_LUA */
|
#else /* USE_LUA */
|
||||||
|
@ -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
|
* If the stask does not have a free slots, the function fails
|
||||||
* and returns 0;
|
* 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;
|
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 = lua_newuserdata(L, sizeof(*chn));
|
||||||
chn->chn = channel;
|
chn->chn = channel;
|
||||||
|
chn->s = s;
|
||||||
|
|
||||||
/* Pop a class sesison metatable and affect it to the userdata. */
|
/* Pop a class sesison metatable and affect it to the userdata. */
|
||||||
lua_rawgeti(L, LUA_REGISTRYINDEX, class_channel_ref);
|
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"));
|
MAY_LJMP(check_args(L, 1, "req_channel"));
|
||||||
s = MAY_LJMP(hlua_checktxn(L, 1));
|
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"));
|
WILL_LJMP(luaL_error(L, "full stack"));
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
@ -2429,7 +2430,7 @@ __LJMP static int hlua_txn_res_channel(lua_State *L)
|
|||||||
MAY_LJMP(check_args(L, 1, "req_channel"));
|
MAY_LJMP(check_args(L, 1, "req_channel"));
|
||||||
s = MAY_LJMP(hlua_checktxn(L, 1));
|
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"));
|
WILL_LJMP(luaL_error(L, "full stack"));
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user