From: Vsevolod Stakhov Date: Tue, 15 Mar 2016 14:57:04 +0000 (+0000) Subject: [Feature] Add workaround for master-slave definitions X-Git-Tag: 1.2.0~39 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=b46f4be88adfaf6db7e47a9591f14212a9e04a27;p=rspamd.git [Feature] Add workaround for master-slave definitions --- diff --git a/src/libutil/upstream.c b/src/libutil/upstream.c index f22092289..020039d71 100644 --- a/src/libutil/upstream.c +++ b/src/libutil/upstream.c @@ -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;