dovecot-2.2: director: Make sure director restart notifications ...

dovecot at dovecot.org dovecot at dovecot.org
Fri Sep 20 10:45:41 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/5d43c926eb97
changeset: 16789:5d43c926eb97
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Sep 20 10:35:34 2013 +0300
description:
director: Make sure director restart notifications go to everyone in the ring.

diffstat:

 src/director/director-connection.c |  19 ++++++++-----------
 1 files changed, 8 insertions(+), 11 deletions(-)

diffs (40 lines):

diff -r b78c705bbb8d -r 5d43c926eb97 src/director/director-connection.c
--- a/src/director/director-connection.c	Fri Sep 20 10:12:24 2013 +0300
+++ b/src/director/director-connection.c	Fri Sep 20 10:35:34 2013 +0300
@@ -625,7 +625,6 @@
 	struct director_host *host;
 	struct ip_addr ip;
 	unsigned int port;
-	bool forward = FALSE;
 
 	if (!director_args_parse_ip_port(conn, args, &ip, &port))
 		return FALSE;
@@ -644,20 +643,18 @@
 		/* already have this. just reset its last_network_failure
 		   timestamp, since it might be up now. */
 		host->last_network_failure = 0;
-		if (host->last_seq != 0 || host->last_sync_seq != 0) {
-			/* it also may have been restarted, reset its state */
-			director_host_restarted(host);
-			forward = TRUE;
-		}
+		/* it also may have been restarted, reset its state */
+		director_host_restarted(host);
 	} else {
 		/* save the director and forward it */
 		host = director_host_add(conn->dir, &ip, port);
-		forward = TRUE;
 	}
-	if (forward) {
-		director_notify_ring_added(host,
-			director_connection_get_host(conn));
-	}
+	/* just forward this to the entire ring until it reaches back to
+	   itself. some hosts may see this twice, but that's the only way to
+	   guarantee that it gets seen by everyone. reseting the host multiple
+	   times may cause us to handle its commands multiple times, but the
+	   commands can handle that. */
+	director_notify_ring_added(host, director_connection_get_host(conn));
 	return TRUE;
 }
 


More information about the dovecot-cvs mailing list