This is used to indicate the type of a check independent of
its server's proxy's check type.

This is in preparation for associating a agent check
with a server which runs as well as the server's existing check.

Signed-off-by: Simon Horman <ho...@verge.net.au>
---
 include/types/server.h |    1 +
 src/checks.c           |    3 ++-
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/include/types/server.h b/include/types/server.h
index e9e5d03..3a0281b 100644
--- a/include/types/server.h
+++ b/include/types/server.h
@@ -122,6 +122,7 @@ struct check {
        int state;                              /* health-check result : CHK_* 
*/
        int health;                             /* 0 to server->rise-1 = bad;
                                                 * rise to 
server->rise+server->fall-1 = good */
+       int type;                               /* Check type, one of 
PR_O2_*_CHK */
        const char *name;                       /* Name of check: "Health" or 
"Agent" */
        struct server *server;                  /* back-pointer to server */
 };
diff --git a/src/checks.c b/src/checks.c
index d75c0a2..2a4f8fd 100644
--- a/src/checks.c
+++ b/src/checks.c
@@ -891,7 +891,7 @@ static void event_srv_chk_r(struct connection *conn)
        }
 
        /* Run the checks... */
-       switch (s->proxy->options2 & PR_O2_CHK_ANY) {
+       switch (check->type) {
        case PR_O2_HTTP_CHK:
                if (!done && check->bi->i < strlen("HTTP/1.0 000\r"))
                        goto wait_more_data;
@@ -1584,6 +1584,7 @@ int start_checks() {
                        }
 
                        s->check.task = t;
+                       s->check.type = s->proxy->options2 & PR_O2_CHK_ANY;
                        t->process = process_chk;
                        t->context = &s->check;
 
-- 
1.7.10.4


Reply via email to