]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
director: When director is removed, notify it before disconnecting
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 14 Sep 2017 14:48:50 +0000 (17:48 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 5 Oct 2017 14:45:38 +0000 (17:45 +0300)
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

index edbdeb4f5b8acb943cecec803572aa24e984912f..bc8b300ba6deb02b8a1a523c20f078ab61e22e50 100644 (file)
@@ -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);
 }