# HG changeset patch # User Timo Sirainen # Date 1505400530 -10800 # Node ID 98b21e27d66c20459809f9cbfc092ecf10c9f4ef # Parent ad4d877d655b934e2b180f59c2b6ef0f6ceab7df 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 -r ad4d877d655b -r 98b21e27d66c src/director/director.c --- 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); }