diff options
author | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-03-15 14:57:04 +0000 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@highsecure.ru> | 2016-03-15 14:57:04 +0000 |
commit | b46f4be88adfaf6db7e47a9591f14212a9e04a27 (patch) | |
tree | 17ce69dfc68a5ccd079897dcd1db99117877aae7 /src/libutil/upstream.c | |
parent | 6151a4b7f85f6d62353d69b602db1fb0bade9402 (diff) | |
download | rspamd-b46f4be88adfaf6db7e47a9591f14212a9e04a27.tar.gz rspamd-b46f4be88adfaf6db7e47a9591f14212a9e04a27.zip |
[Feature] Add workaround for master-slave definitions
Diffstat (limited to 'src/libutil/upstream.c')
-rw-r--r-- | src/libutil/upstream.c | 8 |
1 files changed, 8 insertions, 0 deletions
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; |