From: Christopher Faulet Date: Sat, 9 May 2020 15:34:43 +0000 (+0200) Subject: BUG/MINOR: checks: Rely on next I/O oriented rule when waiting for a connection X-Git-Tag: v2.2-dev8~88 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=97b2a8b01f2ac54e46c8e0d189963df11d61017a;p=thirdparty%2Fhaproxy.git BUG/MINOR: checks: Rely on next I/O oriented rule when waiting for a connection In tcpcheck_main(), when we are waiting for a connection, we must rely on the next connect/send/expect rule to subscribe to I/O events, not on the immediate next rule. Because, if it is a set-var or an unset-var rule, we will not subscribe to I/O events while it is in fact mandatory because a send or an expect rule is coming. It is required to wake-up the health check as soon as I/O are possible, instead of hitting a timeout. No backport needed. (cherry picked from commit 758d48f54cc3372c2d8e7c34b926d218089c533a) Signed-off-by: Christopher Faulet --- diff --git a/src/checks.c b/src/checks.c index 3fc5555cac..90ccff13ea 100644 --- a/src/checks.c +++ b/src/checks.c @@ -2633,18 +2633,21 @@ static int tcpcheck_main(struct check *check) /* 2- check if we are waiting for the connection establishment. It only * happens during TCPCHK_ACT_CONNECT. */ if (check->current_step && check->current_step->action == TCPCHK_ACT_CONNECT) { - rule = LIST_NEXT(&check->current_step->list, typeof(rule), list); if (conn && (conn->flags & CO_FL_WAIT_XPRT)) { - if (rule->action == TCPCHK_ACT_SEND) { + struct tcpcheck_rule *next; + + next = get_next_tcpcheck_rule(check->tcpcheck_rules, check->current_step); + if (next && next->action == TCPCHK_ACT_SEND) { if (!(check->wait_list.events & SUB_RETRY_SEND)) conn->mux->subscribe(cs, SUB_RETRY_SEND, &check->wait_list); } - else if (rule->action == TCPCHK_ACT_EXPECT) { + else { if (!(check->wait_list.events & SUB_RETRY_RECV)) conn->mux->subscribe(cs, SUB_RETRY_RECV, &check->wait_list); } goto out; } + rule = LIST_NEXT(&check->current_step->list, typeof(rule), list); } /* 3- check for pending outgoing data. It only happens during