BUG/MEDIUM: lua: Reset analyse expiration timeout before executing a lua action

Before executing a lua action, the analyse expiration timeout of the
corresponding channel must be reset. Otherwise, when it expires, for instance
because of a call to core.msleep(), if the action yields, an expired timeout
will be used for the stream's task, leading to a loop.

This patch should fix the issue #661. It must be backported in all versions
supporting the lua.

(cherry picked from commit 23308ebf0d603d3f81b4c7a5bdcd82f1cd70c449)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
(cherry picked from commit 638680fafc3dd6a5c562406e5d349d61c9aabcc1)
Signed-off-by: Christopher Faulet <cfaulet@haproxy.com>
diff --git a/src/hlua.c b/src/hlua.c
index a2dde4b..f3c3a5a 100644
--- a/src/hlua.c
+++ b/src/hlua.c
@@ -6852,6 +6852,15 @@
 		s->hlua->max_time = hlua_timeout_session;
 	}
 
+	/* Always reset the analyse expiration timeout for the corresponding
+	 * channel in case the lua script yield, to be sure to not keep an
+	 * expired timeout.
+	 */
+	if (dir == SMP_OPT_DIR_REQ)
+		s->req.analyse_exp = TICK_ETERNITY;
+	else
+		s->res.analyse_exp = TICK_ETERNITY;
+
 	/* Execute the function. */
 	switch (hlua_ctx_resume(s->hlua, !(flags & ACT_FLAG_FINAL))) {
 	/* finished. */