From 6fb4ba38e0bdd7e57ea9af5a3544f972ca11f7b9 Mon Sep 17 00:00:00 2001 From: Willy Tarreau Date: Thu, 21 Sep 2017 17:37:38 +0200 Subject: [PATCH] BUG/MEDIUM: server: unwanted behavior leaving maintenance mode on tracked stopping server (take2) Previous patch got accidently broken. This one fixes it. --- src/server.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/server.c b/src/server.c index 03fca2963..b5904e93a 100644 --- a/src/server.c +++ b/src/server.c @@ -1184,9 +1184,13 @@ void srv_clr_admin_flag(struct server *s, enum srv_admin mode) (!(s->agent.state & CHK_ST_ENABLED) || (s->agent.health >= s->agent.rise)) && (!(s->check.state & CHK_ST_ENABLED) || (s->check.health >= s->check.rise))) { - if (s->track && s->track->next_state == SRV_ST_STOPPING) + if (s->track && s->track->next_state == SRV_ST_STOPPING) { + if (s->last_change < now.tv_sec) // ignore negative times + s->down_time += now.tv_sec - s->last_change; + s->last_change = now.tv_sec; s->next_state = SRV_ST_STOPPING; + } else { if (s->proxy->srv_bck == 0 && s->proxy->srv_act == 0) { if (s->proxy->last_change < now.tv_sec) // ignore negative times