mirror of
http://git.haproxy.org/git/haproxy.git/
synced 2025-01-16 02:30:46 +00:00
BUG/MEDIUM: lua: the Lua process is not waked up after sending data on requests side
If we are writing in the request buffer, we are not waked up when the data are forwarded because it is useles. The request analyzers are waked up only when data is incoming. So, if the request buffer is full, we set the WAKE_ON_WRITE flag.
This commit is contained in:
parent
ef6a2115fd
commit
53e08ecc41
@ -17,6 +17,9 @@
|
||||
#define HLUA_SET_WAKERESWR(__hlua) do {(__hlua)->flags |= HLUA_WAKERESWR;} while(0)
|
||||
#define HLUA_CLR_WAKERESWR(__hlua) do {(__hlua)->flags &= ~HLUA_WAKERESWR;} while(0)
|
||||
#define HLUA_IS_WAKERESWR(__hlua) ((__hlua)->flags & HLUA_WAKERESWR)
|
||||
#define HLUA_SET_WAKEREQWR(__hlua) do {(__hlua)->flags |= HLUA_WAKEREQWR;} while(0)
|
||||
#define HLUA_CLR_WAKEREQWR(__hlua) do {(__hlua)->flags &= ~HLUA_WAKEREQWR;} while(0)
|
||||
#define HLUA_IS_WAKEREQWR(__hlua) ((__hlua)->flags & HLUA_WAKEREQWR)
|
||||
|
||||
#define HLUA_INIT(__hlua) do { (__hlua)->T = 0; } while(0)
|
||||
|
||||
|
@ -19,6 +19,7 @@ struct session;
|
||||
#define HLUA_RUN 0x00000001
|
||||
#define HLUA_CTRLYIELD 0x00000002
|
||||
#define HLUA_WAKERESWR 0x00000004
|
||||
#define HLUA_WAKEREQWR 0x00000008
|
||||
|
||||
enum hlua_exec {
|
||||
HLUA_E_OK = 0,
|
||||
|
@ -2238,7 +2238,9 @@ __LJMP static int _hlua_channel_send(lua_State *L)
|
||||
*/
|
||||
if (chn->chn == chn->s->rep)
|
||||
HLUA_SET_WAKERESWR(hlua);
|
||||
WILL_LJMP(hlua_yieldk(L, 0, 0, _hlua_channel_send, TICK_ETERNITY, 0));
|
||||
else
|
||||
HLUA_SET_WAKEREQWR(hlua);
|
||||
WILL_LJMP(hlua_yieldk(L, 0, 0, hlua_channel_send_yield, TICK_ETERNITY, 0));
|
||||
}
|
||||
|
||||
return 1;
|
||||
@ -2298,6 +2300,8 @@ __LJMP static int hlua_channel_forward_yield(lua_State *L)
|
||||
*/
|
||||
if (chn->chn == chn->s->rep)
|
||||
HLUA_SET_WAKERESWR(hlua);
|
||||
else
|
||||
HLUA_SET_WAKEREQWR(hlua);
|
||||
|
||||
/* Otherwise, we can yield waiting for new data in the inpout side. */
|
||||
WILL_LJMP(hlua_yieldk(L, 0, 0, hlua_channel_forward_yield, TICK_ETERNITY, 0));
|
||||
@ -3269,6 +3273,8 @@ static int hlua_request_act_wrapper(struct hlua_rule *rule, struct proxy *px,
|
||||
if ((analyzer & (AN_REQ_INSPECT_FE|AN_REQ_HTTP_PROCESS_FE)))
|
||||
s->rep->analysers |= analyzer;
|
||||
}
|
||||
if (HLUA_IS_WAKEREQWR(&s->hlua))
|
||||
s->req->flags |= CF_WAKE_WRITE;
|
||||
return 0;
|
||||
|
||||
/* finished with error. */
|
||||
|
Loading…
Reference in New Issue
Block a user