From: Timo Sirainen Date: Mon, 23 Nov 2015 17:35:03 +0000 (+0200) Subject: director: With director_consistent_hashing=yes hosts_hash wasn't always calculated... X-Git-Tag: 2.2.20.rc1~46 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=570153aa925e893dae97d7e097d95eac3a982b86;p=thirdparty%2Fdovecot%2Fcore.git director: With director_consistent_hashing=yes hosts_hash wasn't always calculated right. If different servers had added hosts in different order, the hosts_hash would have become different, which caused errors and resyncs. --- diff --git a/src/director/mail-host.c b/src/director/mail-host.c index 5343e10231..eb573efca7 100644 --- a/src/director/mail-host.c +++ b/src/director/mail-host.c @@ -99,8 +99,6 @@ static void mail_hosts_sort_direct(struct mail_host_list *list) struct mail_host *const *hostp; unsigned int i; - array_sort(&list->hosts, mail_host_cmp); - /* rebuild vhosts */ array_clear(&list->vhosts); array_foreach(&list->hosts, hostp) { @@ -119,6 +117,8 @@ static void mail_hosts_sort(struct mail_host_list *list) struct mail_host *const *hostp; uint32_t num; + array_sort(&list->hosts, mail_host_cmp); + if (list->consistent_hashing) mail_hosts_sort_ring(list); else