From: Timo Sirainen Date: Thu, 14 Sep 2017 14:48:50 +0000 (+0300) Subject: director: When director is removed, notify it before disconnecting X-Git-Tag: 2.2.34~323 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=d97cdcd074c4ff9811d83b6b4cde4db8c4b0e99a;p=thirdparty%2Fdovecot%2Fcore.git director: When director is removed, notify it before disconnecting This way the removed director will know that it's been removed, and it can also more quickly forward the removal to other directors. --- diff --git a/src/director/director.c b/src/director/director.c index edbdeb4f5b..bc8b300ba6 100644 --- a/src/director/director.c +++ b/src/director/director.c @@ -550,6 +550,14 @@ void director_ring_remove(struct director_host *removed_host, director_delayed_dir_remove_timeout, dir); } + /* if our left or ride side gets removed, notify them first + before disconnecting. */ + cmd = t_strdup_printf("DIRECTOR-REMOVE\t%s\t%u\n", + net_ip2addr(&removed_host->ip), + removed_host->port); + director_update_send_version(dir, src, + DIRECTOR_VERSION_RING_REMOVE, cmd); + /* disconnect any connections to the host */ conns = array_get(&dir->connections, &count); for (i = 0; i < count; ) { @@ -563,12 +571,6 @@ void director_ring_remove(struct director_host *removed_host, } if (dir->right == NULL) director_connect(dir, "Reconnecting after director was removed"); - - cmd = t_strdup_printf("DIRECTOR-REMOVE\t%s\t%u\n", - net_ip2addr(&removed_host->ip), - removed_host->port); - director_update_send_version(dir, src, - DIRECTOR_VERSION_RING_REMOVE, cmd); director_sync(dir); }