From: Vsevolod Stakhov Date: Tue, 11 Nov 2014 15:54:18 +0000 (+0000) Subject: Fix crash with unweighted upstreams. X-Git-Tag: 0.7.5~21 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b8ec7dd8ec9c842bc3aa224dff0ab59386399ed5;p=rspamd.git Fix crash with unweighted upstreams. --- 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; }