changeset 19973:0b5aeb95924a

director: Avoid a potential assert-crash after removing a director from ring. This should fix the crash: Panic: director: file director-connection.c: line 1926 (director_connection_init_out): assertion failed: (!host->removed) Also moved the last_network_failure timestamp reset a bit later, since there's no need to reset the timestamp if we're not actually connecting to the server.
author Timo Sirainen <timo.sirainen@dovecot.fi>
date Wed, 30 Mar 2016 08:24:51 +0300
parents f8fd1b5608c8
children 1961d9555bdd
files src/director/director-connection.c
diffstat 1 files changed, 5 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/director/director-connection.c	Tue Mar 29 21:17:22 2016 +0300
+++ b/src/director/director-connection.c	Wed Mar 30 08:24:51 2016 +0300
@@ -1472,8 +1472,6 @@
 	}
 
 	host = director_host_get(conn->dir, &ip, port);
-	/* reset failure timestamp so we'll actually try to connect there. */
-	host->last_network_failure = 0;
 
 	/* remote suggests us to connect elsewhere */
 	if (dir->right != NULL &&
@@ -1485,6 +1483,11 @@
 		return TRUE;
 	}
 
+	/* reset failure timestamp so we'll actually try to connect there. */
+	host->last_network_failure = 0;
+	/* reset removed-flag, so we don't crash */
+	host->removed = FALSE;
+
 	if (dir->right == NULL) {
 		dir_debug("Received CONNECT request to %s, "
 			  "initializing right", host->name);