dovecot-2.0: director: Fixes to connecting to remote director.

dovecot at dovecot.org dovecot at dovecot.org
Thu May 20 11:43:50 EEST 2010


details:   http://hg.dovecot.org/dovecot-2.0/rev/350208d17fcd
changeset: 11349:350208d17fcd
user:      Timo Sirainen <tss at iki.fi>
date:      Thu May 20 10:43:19 2010 +0200
description:
director: Fixes to connecting to remote director.

diffstat:

 src/director/director-connection.c |   5 +++--
 src/director/director.c            |  11 ++++++-----
 2 files changed, 9 insertions(+), 7 deletions(-)

diffs (45 lines):

diff -r e688d58b0112 -r 350208d17fcd src/director/director-connection.c
--- a/src/director/director-connection.c	Thu May 20 10:02:11 2010 +0200
+++ b/src/director/director-connection.c	Thu May 20 10:43:19 2010 +0200
@@ -139,10 +139,11 @@
 		if (dir->left->host != dir->right->host)
 			director_connection_send(dir->right, connect_str);
 		else {
-			/* there are only two directors */
+			/* there are only two directors, and we already have
+			   a connection to this server. */
 		}
 	} else {
-		/* looks like we're the right side. */
+		/* there are only two directors. connect to the other one. */
 		(void)director_connect_host(dir, host);
 	}
 	return TRUE;
diff -r e688d58b0112 -r 350208d17fcd src/director/director.c
--- a/src/director/director.c	Thu May 20 10:02:11 2010 +0200
+++ b/src/director/director.c	Thu May 20 10:43:19 2010 +0200
@@ -80,11 +80,6 @@
 
 	i_assert(dir->right == NULL);
 
-	if (host->last_failed + DIRECTOR_RECONNECT_RETRY_SECS > ioloop_time) {
-		/* failed recently, don't try retrying here */
-		return -1;
-	}
-
 	fd = net_connect_ip(&host->ip, host->port, &dir->self_ip);
 	if (fd == -1) {
 		host->last_failed = ioloop_time;
@@ -110,6 +105,12 @@
 	for (i = 1; i < count; i++) {
 		unsigned int idx = (self_idx + i) % count;
 
+		if (hosts[idx]->last_failed +
+		    DIRECTOR_RECONNECT_RETRY_SECS > ioloop_time) {
+			/* failed recently, don't try retrying here */
+			continue;
+		}
+
 		if (director_connect_host(dir, hosts[idx]) == 0)
 			break;
 	}


More information about the dovecot-cvs mailing list