changeset 18665:b7aed6290e7e

director: Don't send DIRECTOR command infinitely in loop if that director got disconnected.
author Timo Sirainen <tss@iki.fi>
date Wed, 13 May 2015 05:22:22 +0300
parents 502755a1af5f
children e178413a905d
files src/director/director-connection.c
diffstat 1 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/director/director-connection.c	Wed May 13 04:11:34 2015 +0300
+++ b/src/director/director-connection.c	Wed May 13 05:22:22 2015 +0300
@@ -670,8 +670,18 @@
 	   itself. some hosts may see this twice, but that's the only way to
 	   guarantee that it gets seen by everyone. reseting the host multiple
 	   times may cause us to handle its commands multiple times, but the
-	   commands can handle that. */
-	director_notify_ring_added(host, director_connection_get_host(conn));
+	   commands can handle that. however, we need to also handle a
+	   situation where the added director never comes back - we don't want
+	   to send the director information in a loop forever. */
+	if (conn->dir->right != NULL &&
+	    director_host_cmp_to_self(host, conn->dir->right->host,
+				      conn->dir->self_host) > 0) {
+		dir_debug("Received DIRECTOR update for a host where we should be connected to. "
+			  "Not forwarding it since it's probably crashed.");
+	} else {
+		director_notify_ring_added(host,
+			director_connection_get_host(conn));
+	}
 	return TRUE;
 }