]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: checks: add a flag to indicate what check is an agent
authorWilly Tarreau <w@1wt.eu>
Wed, 11 Dec 2013 20:15:19 +0000 (21:15 +0100)
committerWilly Tarreau <w@1wt.eu>
Sat, 14 Dec 2013 15:02:20 +0000 (16:02 +0100)
Currently to know if a check is an agent, we compare its pointer to its
servers' agent pointer. Better have a flag in its state to indicate this.

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

index 91b6f1be9e8d728f2fa5a9bcf6ccbbf66b30860c..7db68b4b0f2a112245cd640e6dc64cf0f007c212 100644 (file)
@@ -39,6 +39,7 @@ enum chk_result {
 #define CHK_ST_CONFIGURED       0x0002  /* this check is configured and may be enabled */
 #define CHK_ST_ENABLED          0x0004  /* this check is currently administratively enabled */
 #define CHK_ST_PAUSED           0x0008  /* checks are paused because of maintenance (health only) */
+#define CHK_ST_AGENT            0x0010  /* check is an agent check (otherwise it's a health check) */
 
 /* check status */
 enum {
index 78c46703d246672408711224fb239e4323df8a13..b02bb0154dfa858b3d3a11b09efbfa1014a9e923 100644 (file)
@@ -5146,7 +5146,7 @@ stats_error_parsing:
                                goto out;
                        }
 
-                       newsrv->agent.state |= CHK_ST_CONFIGURED | CHK_ST_ENABLED;
+                       newsrv->agent.state |= CHK_ST_CONFIGURED | CHK_ST_ENABLED | CHK_ST_AGENT;
                }
 
                if (!defsrv) {
index 47dd523a9977e80fb0f9bd25987d6ceb907a5743..9b00062eaa547d4a342a831cca94e07f39bdb89f 100644 (file)
@@ -233,7 +233,7 @@ static void set_server_check_status(struct check *check, short status, const cha
        /* Failure to connect to the agent as a secondary check should not
         * cause the server to be marked down. So only log status changes
         * for HCHK_STATUS_* statuses */
-       if (check == &s->agent && check->status < HCHK_STATUS_L7TOUT)
+       if ((check->state & CHK_ST_AGENT) && check->status < HCHK_STATUS_L7TOUT)
                return;
 
        if (s->proxy->options2 & PR_O2_LOGHCHKS &&
@@ -626,7 +626,7 @@ static void check_failed(struct check *check)
         * The implication here is that failure to connect to the agent
         * as a secondary check should not cause the server to be marked
         * down. */
-       if (check == &s->agent && check->status != HCHK_STATUS_L7STS)
+       if ((check->state & CHK_ST_AGENT) && check->status != HCHK_STATUS_L7STS)
                return;
 
        if (check->health > check->rise) {
@@ -1532,7 +1532,7 @@ static struct task *process_chk(struct task *t)
                 * configuration of the primary check. Similarly, tcp-check uses
                 * its own strings.
                 */
-               if (check->type && check->type != PR_O2_TCPCHK_CHK && check != &s->agent) {
+               if (check->type && check->type != PR_O2_TCPCHK_CHK && !(check->state & CHK_ST_AGENT)) {
                        bo_putblk(check->bo, s->proxy->check_req, s->proxy->check_len);
 
                        /* we want to check if this host replies to HTTP or SSLv3 requests