MEDIUM: Add state to struct check
Add state to struct check. This is currently used to store one bit,
CHK_RUNNING, which is set if a check is running and clear otherwise.
This bit was previously SRV_CHK_RUNNING of the state element of struct
server.
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+renesas@verge.net.au>
diff --git a/src/checks.c b/src/checks.c
index a2ff237..c37afbd 100644
--- a/src/checks.c
+++ b/src/checks.c
@@ -1315,7 +1315,7 @@
int ret;
int expired = tick_is_expired(t->expire, now_ms);
- if (!(s->state & SRV_CHK_RUNNING)) {
+ if (!(check->state & CHK_STATE_RUNNING)) {
/* no check currently running */
if (!expired) /* woke up too early */
return t;
@@ -1329,7 +1329,7 @@
/* we'll initiate a new check */
set_server_check_status(check, HCHK_STATUS_START, NULL);
- s->state |= SRV_CHK_RUNNING;
+ check->state |= CHK_STATE_RUNNING;
check->bi->p = check->bi->data;
check->bi->i = 0;
check->bo->p = check->bo->data;
@@ -1420,7 +1420,7 @@
/* here, we have seen a synchronous error, no fd was allocated */
- s->state &= ~SRV_CHK_RUNNING;
+ check->state &= ~CHK_STATE_RUNNING;
if (s->health > s->rise) {
s->health--; /* still good */
s->counters.failed_checks++;
@@ -1516,7 +1516,7 @@
set_server_up(check);
}
}
- s->state &= ~SRV_CHK_RUNNING;
+ check->state &= ~CHK_STATE_RUNNING;
rv = 0;
if (global.spread_checks > 0) {
diff --git a/src/dumpstats.c b/src/dumpstats.c
index 9a422c1..be0aac6 100644
--- a/src/dumpstats.c
+++ b/src/dumpstats.c
@@ -2273,7 +2273,7 @@
if (sv->state & SRV_CHECKED) {
chunk_appendf(&trash,
"</td><td class=ac><u> %s%s",
- (sv->state & SRV_CHK_RUNNING) ? "* " : "",
+ (sv->check.state & CHK_STATE_RUNNING) ? "* " : "",
get_check_status_info(sv->check.status));
if (sv->check.status >= HCHK_STATUS_L57DATA)