From d97cdcd074c4ff9811d83b6b4cde4db8c4b0e99a Mon Sep 17 00:00:00 2001 From: Timo Sirainen Date: Thu, 14 Sep 2017 17:48:50 +0300 Subject: [PATCH] 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. --- src/director/director.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) 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); } -- 2.47.3