dovecot-2.0: director: Reset hosts' last_failed timestamps when ...

dovecot at dovecot.org dovecot at dovecot.org
Fri Apr 8 19:36:54 EEST 2011


details:   http://hg.dovecot.org/dovecot-2.0/rev/2b7af3a16521
changeset: 12727:2b7af3a16521
user:      Timo Sirainen <tss at iki.fi>
date:      Fri Apr 08 19:35:27 2011 +0300
description:
director: Reset hosts' last_failed timestamps when they're suspected to be working again.
This should fix some problems during director removals and additions.

diffstat:

 src/director/director-connection.c |  11 ++++++++++-
 src/director/director.c            |   3 +++
 2 files changed, 13 insertions(+), 1 deletions(-)

diffs (55 lines):

diff -r e2b747f88e54 -r 2b7af3a16521 src/director/director-connection.c
--- a/src/director/director-connection.c	Fri Apr 08 17:27:52 2011 +0300
+++ b/src/director/director-connection.c	Fri Apr 08 19:35:27 2011 +0300
@@ -110,6 +110,9 @@
 		return FALSE;
 	}
 	host = director_host_get(dir, &ip, port);
+	/* the host is up now, make sure we can connect to it immediately
+	   if needed */
+	host->last_failed = 0;
 	conn->me_received = TRUE;
 
 	if (!conn->in)
@@ -286,7 +289,9 @@
 
 	host = director_host_lookup(conn->dir, &ip, port);
 	if (host != NULL) {
-		/* already have this, skip */
+		/* already have this. just reset its last_failed timestamp,
+		   since it might be up now. */
+		host->last_failed = 0;
 		return TRUE;
 	}
 
@@ -474,6 +479,7 @@
 	if (dir->debug)
 		i_debug("Handshaked to %s", conn->host->name);
 
+	conn->host->last_failed = 0;
 	conn->handshake_received = TRUE;
 	if (conn->in) {
 		/* handshaked to left side. tell it we've received the
@@ -548,6 +554,9 @@
 
 		conn->dir->right = NULL;
 		host = director_host_get(conn->dir, &ip, port);
+		/* reset failure timestamp so we'll actually try to
+		   connect there. */
+		host->last_failed = 0;
 		(void)director_connect_host(conn->dir, host);
 		return FALSE;
 	}
diff -r e2b747f88e54 -r 2b7af3a16521 src/director/director.c
--- a/src/director/director.c	Fri Apr 08 17:27:52 2011 +0300
+++ b/src/director/director.c	Fri Apr 08 19:35:27 2011 +0300
@@ -94,6 +94,9 @@
 		i_error("connect(%s) failed: %m", host->name);
 		return -1;
 	}
+	/* Reset timestamp so that director_connect() won't skip this host
+	   while we're still trying to connect to it */
+	host->last_failed = 0;
 
 	director_connection_init_out(dir, fd, host);
 	return 0;


More information about the dovecot-cvs mailing list