summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVsevolod Stakhov <vsevolod@highsecure.ru>2014-11-11 15:54:18 +0000
committerVsevolod Stakhov <vsevolod@highsecure.ru>2014-11-11 15:54:18 +0000
commitb8ec7dd8ec9c842bc3aa224dff0ab59386399ed5 (patch)
tree4d46d5f5795326b47cc567083500d78bd6304209
parent78938e41c02ad901ecc97ed6040008d3c368924b (diff)
downloadrspamd-b8ec7dd8ec9c842bc3aa224dff0ab59386399ed5.tar.gz
rspamd-b8ec7dd8ec9c842bc3aa224dff0ab59386399ed5.zip
Fix crash with unweighted upstreams.
-rw-r--r--src/libutil/upstream.c4
1 files changed, 2 insertions, 2 deletions
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;
}