diff src/director/director-connection.c @ 18708:51ee438392c7

director: Moving a user to another host sometimes caused the move to fail. It could have given "User hash .. is being redirected to two hosts" error and afterwards moved the user back to its original host.
author Timo Sirainen <tss@iki.fi>
date Fri, 15 May 2015 16:44:45 +0300
parents b7aed6290e7e
children 0ee3e734249a
line wrap: on
line diff
--- a/src/director/director-connection.c	Fri May 15 14:55:21 2015 +0300
+++ b/src/director/director-connection.c	Fri May 15 16:44:45 2015 +0300
@@ -506,6 +506,15 @@
 			  "replacing host %s with %s", username_hash,
 			  net_ip2addr(&user->host->ip), net_ip2addr(&host->ip));
 		ret = TRUE;
+	} else if (user->kill_state != USER_KILL_STATE_NONE &&
+		   user->kill_state < USER_KILL_STATE_DELAY) {
+		/* user is still being moved - ignore conflicting host updates
+		   from other directors who don't yet know about the move. */
+		dir_debug("user refresh: %u is being moved, "
+			  "preserve its host %s instead of replacing with %s",
+			  username_hash, net_ip2addr(&user->host->ip),
+			  net_ip2addr(&host->ip));
+		host = user->host;
 	} else {
 		/* non-weak user received a non-weak update with
 		   conflicting host. this shouldn't happen. */