MINOR: checks: rename the state flags
The flag CHK_STATE_RUNNING is misleading as one may believe it means the state is enabled (just like SRV_RUNNING). Let's rename these two flags CHK_ST_INPROGRESS and CHK_ST_DISABLED.
This commit is contained in:
parent
6aaa1b87cf
commit
2c115e5047
|
@ -34,9 +34,9 @@ enum chk_result {
|
|||
CHK_RES_CONDPASS, /* check reports the server doesn't want new sessions */
|
||||
};
|
||||
|
||||
/* check flags */
|
||||
#define CHK_STATE_RUNNING 0x0001 /* this check is currently running */
|
||||
#define CHK_STATE_DISABLED 0x0002 /* this check is currently administratively disabled */
|
||||
/* flags used by check->state */
|
||||
#define CHK_ST_INPROGRESS 0x0001 /* a check is currently running */
|
||||
#define CHK_ST_DISABLED 0x0002 /* this check is currently administratively disabled */
|
||||
|
||||
/* check status */
|
||||
enum {
|
||||
|
@ -134,7 +134,7 @@ struct check {
|
|||
struct tcpcheck_rule *current_step; /* current step when using tcpcheck */
|
||||
int inter, fastinter, downinter; /* checks: time in milliseconds */
|
||||
enum chk_result result; /* health-check result : CHK_RES_* */
|
||||
int state; /* health-check result : CHK_* */
|
||||
int state; /* state of the check : CHK_ST_* */
|
||||
int health; /* 0 to rise-1 = bad;
|
||||
* rise to rise+fall-1 = good */
|
||||
int rise, fall; /* time in iterations */
|
||||
|
|
12
src/checks.c
12
src/checks.c
|
@ -1165,7 +1165,7 @@ static void event_srv_chk_r(struct connection *conn)
|
|||
* parameter of this function is the agent or check field
|
||||
* of the server.
|
||||
*/
|
||||
disabled = check->server->agent.state & CHK_STATE_DISABLED;
|
||||
disabled = check->server->agent.state & CHK_ST_DISABLED;
|
||||
|
||||
if (strchr(check->bi->data, '%')) {
|
||||
if (disabled)
|
||||
|
@ -1497,7 +1497,7 @@ static struct task *process_chk(struct task *t)
|
|||
int ret;
|
||||
int expired = tick_is_expired(t->expire, now_ms);
|
||||
|
||||
if (!(check->state & CHK_STATE_RUNNING)) {
|
||||
if (!(check->state & CHK_ST_INPROGRESS)) {
|
||||
/* no check currently running */
|
||||
if (!expired) /* woke up too early */
|
||||
return t;
|
||||
|
@ -1509,13 +1509,13 @@ static struct task *process_chk(struct task *t)
|
|||
if (!(s->state & SRV_CHECKED) ||
|
||||
s->proxy->state == PR_STSTOPPED ||
|
||||
(s->state & SRV_MAINTAIN) ||
|
||||
(check->state & CHK_STATE_DISABLED))
|
||||
(check->state & CHK_ST_DISABLED))
|
||||
goto reschedule;
|
||||
|
||||
/* we'll initiate a new check */
|
||||
set_server_check_status(check, HCHK_STATUS_START, NULL);
|
||||
|
||||
check->state |= CHK_STATE_RUNNING;
|
||||
check->state |= CHK_ST_INPROGRESS;
|
||||
check->bi->p = check->bi->data;
|
||||
check->bi->i = 0;
|
||||
check->bo->p = check->bo->data;
|
||||
|
@ -1619,7 +1619,7 @@ static struct task *process_chk(struct task *t)
|
|||
|
||||
/* here, we have seen a synchronous error, no fd was allocated */
|
||||
|
||||
check->state &= ~CHK_STATE_RUNNING;
|
||||
check->state &= ~CHK_ST_INPROGRESS;
|
||||
check_failed(check);
|
||||
|
||||
/* we allow up to min(inter, timeout.connect) for a connection
|
||||
|
@ -1687,7 +1687,7 @@ static struct task *process_chk(struct task *t)
|
|||
set_server_up(check);
|
||||
}
|
||||
}
|
||||
check->state &= ~CHK_STATE_RUNNING;
|
||||
check->state &= ~CHK_ST_INPROGRESS;
|
||||
|
||||
rv = 0;
|
||||
if (global.spread_checks > 0) {
|
||||
|
|
|
@ -1528,8 +1528,7 @@ static int stats_sock_parse_request(struct stream_interface *si, char *line)
|
|||
if (!sv)
|
||||
return 1;
|
||||
|
||||
sv->agent.state &= ~CHK_STATE_DISABLED;
|
||||
|
||||
sv->agent.state &= ~CHK_ST_DISABLED;
|
||||
return 1;
|
||||
}
|
||||
if (strcmp(args[1], "server") == 0) {
|
||||
|
@ -1600,8 +1599,7 @@ static int stats_sock_parse_request(struct stream_interface *si, char *line)
|
|||
if (!sv)
|
||||
return 1;
|
||||
|
||||
sv->agent.state |= CHK_STATE_DISABLED;
|
||||
|
||||
sv->agent.state |= CHK_ST_DISABLED;
|
||||
return 1;
|
||||
}
|
||||
else if (strcmp(args[1], "server") == 0) {
|
||||
|
@ -2723,7 +2721,7 @@ static int stats_dump_sv_stats(struct stream_interface *si, struct proxy *px, in
|
|||
if (sv->state & SRV_CHECKED) {
|
||||
chunk_appendf(&trash,
|
||||
"</td><td class=ac><u> %s%s",
|
||||
(sv->check.state & CHK_STATE_RUNNING) ? "* " : "",
|
||||
(sv->check.state & CHK_ST_INPROGRESS) ? "* " : "",
|
||||
get_check_status_info(sv->check.status));
|
||||
|
||||
if (sv->check.status >= HCHK_STATUS_L57DATA)
|
||||
|
|
Loading…
Reference in New Issue