From b8ec7dd8ec9c842bc3aa224dff0ab59386399ed5 Mon Sep 17 00:00:00 2001 From: Vsevolod Stakhov Date: Tue, 11 Nov 2014 15:54:18 +0000 Subject: [PATCH] Fix crash with unweighted upstreams. --- src/libutil/upstream.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libutil/upstream.c b/src/libutil/upstream.c index b5f1ed35e..5314a8ffa 100644 --- a/src/libutil/upstream.c +++ b/src/libutil/upstream.c @@ -577,13 +577,13 @@ rspamd_upstream_get_round_robin (struct upstream_list *ups, gboolean use_cur) for (i = 0; i < ups->alive->len; i ++) { up = g_ptr_array_index (ups->alive, i); if (use_cur) { - if (up->cur_weight > max_weight) { + if (up->cur_weight >= max_weight) { selected = up; max_weight = up->cur_weight; } } else { - if (up->weight > max_weight) { + if (up->weight >= max_weight) { selected = up; max_weight = up->weight; } -- 2.39.5