From: Willy Tarreau Date: Sun, 27 Sep 2015 08:48:01 +0000 (+0200) Subject: MEDIUM: lua: only allow actions to yield if not in a final call X-Git-Tag: v1.6-dev6~44 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=528192d310643b11b182f530179048d44483d393;p=thirdparty%2Fhaproxy.git MEDIUM: lua: only allow actions to yield if not in a final call Actions may yield but must not do it during the final call from a ruleset because it indicates there will be no more opportunity to complete or clean up. This is indicated by ACT_FLAG_FINAL in the action's flags, which must be passed to hlua_resume(). Thanks to this, an action called from a TCP ruleset is properly woken up and possibly finished when the client disconnects. --- diff --git a/src/hlua.c b/src/hlua.c index c641c78e04..77058f057f 100644 --- a/src/hlua.c +++ b/src/hlua.c @@ -4549,7 +4549,7 @@ static enum act_return hlua_action(struct act_rule *rule, struct proxy *px, } /* Execute the function. */ - switch (hlua_ctx_resume(&s->hlua, 1)) { + switch (hlua_ctx_resume(&s->hlua, !(flags & ACT_FLAG_FINAL))) { /* finished. */ case HLUA_E_OK: if (!hlua_check_proto(s, dir))