]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: checks: support a neutral check result
authorWilly Tarreau <w@1wt.eu>
Tue, 20 May 2014 18:56:30 +0000 (20:56 +0200)
committerWilly Tarreau <w@1wt.eu>
Fri, 23 May 2014 13:42:49 +0000 (15:42 +0200)
Agent will have the ability to return a weight without indicating an
up/down status. Currently this is not possible, so let's add a 5th
result CHK_RES_NEUTRAL for this purpose. It has been mapped to the
unused HCHK_STATUS_CHECKED which already serves as a neutral delimitor
between initiated checks and those returning a result.

include/types/checks.h
src/checks.c

index 83ea2b510f55b2b7dc471713ede80ac205291d55..d5038ebc816c24bf6c139360c5e4dab9793ff4be 100644 (file)
@@ -29,6 +29,7 @@
  */
 enum chk_result {
        CHK_RES_UNKNOWN = 0,            /* initialized to this by default */
+       CHK_RES_NEUTRAL,                /* valid check but no status information */
        CHK_RES_FAILED,                 /* check failed */
        CHK_RES_PASSED,                 /* check succeeded and server is fully up again */
        CHK_RES_CONDPASS,               /* check reports the server doesn't want new sessions */
index d5216dd1db0b817dcfd7e6c164f033ac642bdca1..fc7e776375f833661caf0169ea6687af219a028b 100644 (file)
@@ -66,6 +66,8 @@ static const struct check_status check_statuses[HCHK_STATUS_SIZE] = {
        [HCHK_STATUS_INI]       = { CHK_RES_UNKNOWN,  "INI",     "Initializing" },
        [HCHK_STATUS_START]     = { /* SPECIAL STATUS*/ },
 
+       /* Below we have finished checks */
+       [HCHK_STATUS_CHECKED]   = { CHK_RES_NEUTRAL,  "CHECKED", "No status change" },
        [HCHK_STATUS_HANA]      = { CHK_RES_FAILED,   "HANA",    "Health analyze" },
 
        [HCHK_STATUS_SOCKERR]   = { CHK_RES_FAILED,   "SOCKERR", "Socket error" },
@@ -232,6 +234,10 @@ static void set_server_check_status(struct check *check, short status, const cha
                tv_zero(&check->start);
        }
 
+       /* no change is expected if no state change occurred */
+       if (check->result == CHK_RES_NEUTRAL)
+               return;
+
        report = 0;
 
        switch (check->result) {