MINOR: checks: add a flag to indicate what check is an agent
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.
diff --git a/src/checks.c b/src/checks.c
index 47dd523..9b00062 100644
--- a/src/checks.c
+++ b/src/checks.c
@@ -233,7 +233,7 @@
/* 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 @@
* 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 @@
* 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