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 <horms+rene...@verge.net.au>
---
 include/types/server.h |    1 +
 src/cfgparse.c         |    5 +++--
 src/checks.c           |    2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/include/types/server.h b/include/types/server.h
index f6d98a2..97e09ca 100644
--- a/include/types/server.h
+++ b/include/types/server.h
@@ -120,6 +120,7 @@ struct check {
        int inter, fastinter, downinter;        /* checks: time in milliseconds 
*/
        int result;                             /* health-check result : 
SRV_CHK_* */
        int state;                              /* health-check result : CHK_* 
*/
+       const char *name;                       /* Name of check: "Health" or 
"Agent" */
        struct server *server;                  /* back-pointer to server */
 };
 
diff --git a/src/cfgparse.c b/src/cfgparse.c
index c23a48d..d5c59d9 100644
--- a/src/cfgparse.c
+++ b/src/cfgparse.c
@@ -1619,7 +1619,7 @@ out:
        return err_code;
 }
 
-static int init_check(struct server *s, struct check *check, const char * 
file, int linenum)
+static int init_check(struct server *s, const char *name, struct check *check, 
const char * file, int linenum)
 {
        /* Allocate buffer for requests... */
        if ((check->bi = calloc(sizeof(struct buffer) + global.tune.chksize, 
sizeof(char))) == NULL) {
@@ -1644,6 +1644,7 @@ static int init_check(struct server *s, struct check 
*check, const char * file,
        check->conn->t.sock.fd = -1; /* no agent in progress yet */
        check->status = HCHK_STATUS_INI;
        check->server = s;
+       check->name = name;
 
        return 0;
 }
@@ -4747,7 +4748,7 @@ stats_error_parsing:
                                goto out;
                        }
 
-                       ret = init_check(newsrv, &newsrv->check, file, linenum);
+                       ret = init_check(newsrv, "Health", &newsrv->check, 
file, linenum);
                        if (ret) {
                                err_code |= ret;
                                goto out;
diff --git a/src/checks.c b/src/checks.c
index 700397a..0379ac2 100644
--- a/src/checks.c
+++ b/src/checks.c
@@ -274,7 +274,7 @@ static void set_server_check_status(struct check *check, 
short status, const cha
                /* FIXME end: calculate local version of the 
health/rise/fall/state */
 
                chunk_appendf(&trash,
-                            "Health check for %sserver %s/%s %s%s",
+                            "%s check for %sserver %s/%s %s%s", check->name,
                             s->state & SRV_BACKUP ? "backup " : "",
                             s->proxy->id, s->id,
                             (check->result & SRV_CHK_DISABLE)?"conditionally 
":"",
-- 
1.7.10.4


Reply via email to