]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: checks: Rely on next I/O oriented rule when waiting for a connection
authorChristopher Faulet <cfaulet@haproxy.com>
Sat, 9 May 2020 15:34:43 +0000 (17:34 +0200)
committerChristopher Faulet <cfaulet@haproxy.com>
Tue, 12 May 2020 08:06:47 +0000 (10:06 +0200)
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 <cfaulet@haproxy.com>
src/checks.c

index 3fc5555cac36da83f0decf786b4df7814b841121..90ccff13ead99f5e064387f02433d2d3e7ffce6f 100644 (file)
@@ -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