From 4146bb402c0068961fb3416cf8e05c79f7f0c31a Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Wed, 19 Jul 2017 21:15:05 +0100 Subject: [PATCH] [Minor] Add some sanity checks when managing monitoring timeouts --- src/libserver/monitored.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libserver/monitored.c b/src/libserver/monitored.c index 9ee4a228b..cc11183b2 100644 --- a/src/libserver/monitored.c +++ b/src/libserver/monitored.c @@ -94,7 +94,11 @@ rspamd_monitored_propagate_error (struct rspamd_monitored *m, m->cur_errors ++; /* Reduce timeout */ rspamd_monitored_stop (m); - m->monitoring_mult /= 2.0; + + if (m->monitoring_mult > 0.1) { + m->monitoring_mult /= 2.0; + } + rspamd_monitored_start (m); } else { @@ -132,6 +136,7 @@ rspamd_monitored_propagate_success (struct rspamd_monitored *m, gdouble lat) gdouble t; m->cur_errors = 0; + m->monitoring_mult = 1.0; if (!m->alive) { t = rspamd_get_calendar_ticks (); @@ -144,7 +149,6 @@ rspamd_monitored_propagate_success (struct rspamd_monitored *m, gdouble lat) m->nchecks = 1; m->latency = lat; rspamd_monitored_stop (m); - m->monitoring_mult = 1.0; rspamd_monitored_start (m); if (m->ctx->change_cb) { -- 2.39.5