changeset 11581:ecf195115922 HEAD

director: If same user gets redirected to two hosts, don't crash later.
author Timo Sirainen <tss@iki.fi>
date Fri, 18 Jun 2010 16:37:09 +0100
parents 6aa749b789ef
children fb917e3a8f07
files src/director/director-connection.c
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/director/director-connection.c	Fri Jun 18 16:28:49 2010 +0100
+++ b/src/director/director-connection.c	Fri Jun 18 16:37:09 2010 +0100
@@ -175,7 +175,13 @@
 			"%s and %s", username_hash,
 			net_ip2addr(&user->host->ip),
 			net_ip2addr(&host->ip));
+
+		/* change the host anyway. we'll also need to remove the user
+		   from the old host's user_count, because we can't keep track
+		   of the user for more than one host */
+		user->host->user_count--;
 		user->host = host;
+		user->host->user_count++;
 		ret = TRUE;
 	}
 	*user_r = user;