From d0e29ef0e3644a852ee7439fa26bc65ebd3a1e7b Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Thu, 23 Jun 2016 18:27:07 +0100 Subject: [Fix] Try to fix upstreams with one element --- src/libutil/upstream.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/libutil/upstream.c b/src/libutil/upstream.c index 43d9f7448..8ea61bc20 100644 --- a/src/libutil/upstream.c +++ b/src/libutil/upstream.c @@ -416,7 +416,7 @@ rspamd_upstream_fail (struct upstream *up) max_error_rate = 0; } - if (error_rate > max_error_rate && up->active_idx != -1) { + if (up->ls->ups->len > 1 && error_rate > max_error_rate) { /* Remove upstream from the active list */ up->errors = 0; rspamd_upstream_set_inactive (up->ls, up); @@ -723,7 +723,10 @@ rspamd_upstream_restore_cb (gpointer elt, gpointer ls) /* Here the upstreams list is already locked */ RSPAMD_UPSTREAM_LOCK (up->lock); - event_del (&up->ev); + + if (event_get_base (&up->ev)) { + event_del (&up->ev); + } g_ptr_array_add (ups->alive, up); up->active_idx = ups->alive->len - 1; RSPAMD_UPSTREAM_UNLOCK (up->lock); -- cgit v1.2.3