diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-07-19 21:15:05 +0100 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2017-07-19 21:15:05 +0100 |
commit | 5d37e69a60b836818823a6c43cb4269d10d82094 (patch) | |
tree | 5f7376912998bee6abf29bd31080f7028120e353 | |
parent | 44c51bd8b5301f20a0fe4a95b3d15b6d14520bd1 (diff) | |
download | rspamd-5d37e69a60b836818823a6c43cb4269d10d82094.tar.gz rspamd-5d37e69a60b836818823a6c43cb4269d10d82094.zip |
[Minor] Add some sanity checks when managing monitoring timeouts
-rw-r--r-- | src/libserver/monitored.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/libserver/monitored.c b/src/libserver/monitored.c index 3202b80af..01979b11e 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) { |