]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
director: Don't reset directors' last_network_failure while handshaking
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 14 Sep 2017 14:38:24 +0000 (17:38 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Fri, 15 Sep 2017 09:00:29 +0000 (12:00 +0300)
The reset is done mainly to make it faster for a director that has been down
to connect back to the ring, without other directors still thinking that
it's down. But DIRECTOR that is sent during handshake says nothing about
whether the director is up at the moment or not.

src/director/director-connection.c

index dc0b898374536c80ba87dfa9478c695b0954d270..cfbe5dff3a34b023f50b805e5b2f6bd3bcaf4721 100644 (file)
@@ -761,8 +761,12 @@ static bool director_cmd_director(struct director_connection *conn,
                }
 
                /* already have this. just reset its last_network_failure
-                  timestamp, since it might be up now. */
-               host->last_network_failure = 0;
+                  timestamp, since it might be up now, but only if this
+                  isn't part of the handshake. (if it was, reseting the
+                  timestamp could cause us to rapidly keep trying to connect
+                  to it) */
+               if (conn->handshake_received)
+                       host->last_network_failure = 0;
                /* it also may have been restarted, reset its state */
                director_host_restarted(host);
        } else {