]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
BUG/MINOR: checks: make __event_chk_srv_r() report success before closing
authorWilly Tarreau <w@1wt.eu>
Thu, 5 Sep 2019 16:43:22 +0000 (18:43 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 6 Sep 2019 06:13:15 +0000 (08:13 +0200)
On a plain TCP check, this function will do nothing except shutting the
connection down and will not even update the status. This prevents it
from being called again, which is the reason why we attempt to do it
once too early. Let's first fix this function to make it report success
on plain TCP checks before closing, as it does for all other ones.

This must be backported to 2.0. It should be safe to backport to older
versions but it doesn't seem it would fix anything there.

src/checks.c

index 55e8a17a09b02655e0f1614c07a5337f7235fd33..1268cda5eea64c3ac177e769b8f5c6778fe706ab 100644 (file)
@@ -1378,7 +1378,13 @@ static void __event_srv_chk_r(struct conn_stream *cs)
        }
 
        default:
-               /* for other checks (eg: pure TCP), delegate to the main task */
+               /* good connection is enough for pure TCP check */
+               if ((conn->flags & CO_FL_CONNECTED) && !check->type) {
+                       if (check->use_ssl)
+                               set_server_check_status(check, HCHK_STATUS_L6OK, NULL);
+                       else
+                               set_server_check_status(check, HCHK_STATUS_L4OK, NULL);
+               }
                break;
        } /* switch */