From: Timo Sirainen Date: Wed, 30 Mar 2016 05:24:51 +0000 (+0300) Subject: director: Avoid a potential assert-crash after removing a director from ring. X-Git-Tag: 2.2.23~4 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=128216edbfb4bbf58cbabd0c77e78c87c2c47407;p=thirdparty%2Fdovecot%2Fcore.git 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. --- diff --git a/src/director/director-connection.c b/src/director/director-connection.c index 9c058f2150..a727658efd 100644 --- a/src/director/director-connection.c +++ b/src/director/director-connection.c @@ -1472,8 +1472,6 @@ static bool director_cmd_connect(struct director_connection *conn, } 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 @@ static bool director_cmd_connect(struct director_connection *conn, 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);