]> source.dussan.org Git - rspamd.git/commitdiff
[Feature] Add workaround for master-slave definitions
authorVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 15 Mar 2016 14:57:04 +0000 (14:57 +0000)
committerVsevolod Stakhov <vsevolod@highsecure.ru>
Tue, 15 Mar 2016 14:57:04 +0000 (14:57 +0000)
src/libutil/upstream.c

index f2209228919a16dceddbc76a50c72d5e8cfa9c26..020039d7139eb9e040806a2e75295bb64c1aa88f 100644 (file)
@@ -541,6 +541,14 @@ rspamd_upstreams_add_upstream (struct upstream_list *ups,
                g_ptr_array_free (addrs, TRUE);
        }
 
+       if (up->weight == 0 && ups->rot_alg == RSPAMD_UPSTREAM_MASTER_SLAVE) {
+               /* Special heuristic for master-slave rotation */
+               if (ups->ups->len == 0) {
+                       /* Prioritize the first */
+                       up->weight = 1;
+               }
+       }
+
        g_ptr_array_add (ups->ups, up);
        up->ud = data;
        up->cur_weight = up->weight;