Mercurial > dovecot > core-2.2
changeset 22566:98b21e27d66c
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.
author | Timo Sirainen <timo.sirainen@dovecot.fi> |
---|---|
date | Thu, 14 Sep 2017 17:48:50 +0300 |
parents | ad4d877d655b |
children | c27c8ce1d534 |
files | src/director/director.c |
diffstat | 1 files changed, 8 insertions(+), 6 deletions(-) [+] |
line wrap: on
line diff
--- a/src/director/director.c Thu Sep 14 17:38:24 2017 +0300 +++ b/src/director/director.c Thu Sep 14 17:48:50 2017 +0300 @@ -550,6 +550,14 @@ 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 @@ } 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); }