dovecot-2.1: director: Reset last-seen-sync-sequence after remot...

dovecot at dovecot.org dovecot at dovecot.org
Wed Aug 21 23:30:13 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.1/rev/5d6cc3d03eee
changeset: 14996:5d6cc3d03eee
user:      Timo Sirainen <tss at iki.fi>
date:      Wed Aug 21 23:30:07 2013 +0300
description:
director: Reset last-seen-sync-sequence after remote director restarts.

diffstat:

 src/director/director-connection.c |  6 +++---
 src/director/director-host.c       |  8 ++++++++
 src/director/director-host.h       |  2 ++
 3 files changed, 13 insertions(+), 3 deletions(-)

diffs (60 lines):

diff -r d463fab6db95 -r 5d6cc3d03eee src/director/director-connection.c
--- a/src/director/director-connection.c	Thu Aug 15 20:25:12 2013 +0300
+++ b/src/director/director-connection.c	Wed Aug 21 23:30:07 2013 +0300
@@ -406,7 +406,7 @@
 	conn->host->removed = FALSE;
 	director_host_ref(conn->host);
 	/* make sure we don't keep old sequence values across restarts */
-	conn->host->last_seq = 0;
+	director_host_restarted(conn->host);
 
 	next_comm_attempt = conn->host->last_protocol_failure +
 		DIRECTOR_PROTOCOL_FAILURE_RETRY_SECS;
@@ -646,7 +646,7 @@
 		host->last_network_failure = 0;
 		if (host->last_seq != 0) {
 			/* it also may have been restarted, reset last_seq */
-			host->last_seq = 0;
+			director_host_restarted(host);
 			forward = TRUE;
 		}
 	} else {
@@ -1593,7 +1593,7 @@
 	i_assert(!host->removed);
 
 	/* make sure we don't keep old sequence values across restarts */
-	host->last_seq = 0;
+	director_host_restarted(host);
 
 	conn = director_connection_init_common(dir, fd);
 	conn->name = i_strdup_printf("%s/out", host->name);
diff -r d463fab6db95 -r 5d6cc3d03eee src/director/director-host.c
--- a/src/director/director-host.c	Thu Aug 15 20:25:12 2013 +0300
+++ b/src/director/director-host.c	Wed Aug 21 23:30:07 2013 +0300
@@ -80,6 +80,14 @@
 	i_free(host);
 }
 
+void director_host_restarted(struct director_host *host)
+{
+	host->last_seq = 0;
+	host->last_sync_seq = 0;
+	host->last_sync_seq_counter = 0;
+	host->last_sync_timestamp = 0;
+}
+
 struct director_host *
 director_host_get(struct director *dir, const struct ip_addr *ip,
 		  unsigned int port)
diff -r d463fab6db95 -r 5d6cc3d03eee src/director/director-host.h
--- a/src/director/director-host.h	Thu Aug 15 20:25:12 2013 +0300
+++ b/src/director/director-host.h	Wed Aug 21 23:30:07 2013 +0300
@@ -39,6 +39,8 @@
 void director_host_ref(struct director_host *host);
 void director_host_unref(struct director_host *host);
 
+void director_host_restarted(struct director_host *host);
+
 struct director_host *
 director_host_get(struct director *dir, const struct ip_addr *ip,
 		  unsigned int port);


More information about the dovecot-cvs mailing list