]> source.dussan.org Git - rspamd.git/commitdiff
Fix crash with unweighted upstreams.
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 11 Nov 2014 15:54:18 +0000 (15:54 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 11 Nov 2014 15:54:18 +0000 (15:54 +0000)
src/libutil/upstream.c

index b5f1ed35e71082876dc10a49dfb7c2e7b672574c..5314a8ffac440578433f4812e2ca9bb5189748c8 100644 (file)
@@ -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;
                        }