BUG/MEDIUM: checks: ensure we can enable a server after boot

Since commit 58c3297 (MEDIUM: Set rise and fall of agent checks to 1),
due to a bogus condition, it became impossible to re-enable a server
that was disabled in the configuration if no agent was enabled. The
reason is that in this case, the agent's health was zero while the
condition expected it to be at least one to consider the action.

Let's fix this by only considering the health of checks that are enabled.
This commit is contained in:
Willy Tarreau 2013-12-14 16:14:15 +01:00
parent 0d924cc74c
commit bb9665e649
1 changed files with 3 additions and 2 deletions

View File

@ -479,8 +479,9 @@ void set_server_up(struct check *check) {
check->health = check->rise; check->health = check->rise;
} }
if ((s->check.health >= s->check.rise && s->agent.health >= s->agent.rise && if (s->track ||
check->health == check->rise) || s->track) { (s->check.health == s->check.rise && (s->agent.health >= s->agent.rise || !(s->agent.state & CHK_ST_ENABLED))) ||
(s->agent.health == s->agent.rise && (s->check.health >= s->check.rise || !(s->check.state & CHK_ST_ENABLED)))) {
if (s->proxy->srv_bck == 0 && s->proxy->srv_act == 0) { if (s->proxy->srv_bck == 0 && s->proxy->srv_act == 0) {
if (s->proxy->last_change < now.tv_sec) // ignore negative times if (s->proxy->last_change < now.tv_sec) // ignore negative times
s->proxy->down_time += now.tv_sec - s->proxy->last_change; s->proxy->down_time += now.tv_sec - s->proxy->last_change;