BUG/MEDIUM: server: unwanted behavior leaving maintenance mode on tracked stopping server (take2)
Previous patch got accidently broken. This one fixes it.
diff --git a/src/server.c b/src/server.c
index 03fca29..b5904e9 100644
--- a/src/server.c
+++ b/src/server.c
@@ -1184,9 +1184,13 @@
(!(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