From 64304635b70cdeefc83ae1de627068691513824f Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Fri, 31 Dec 2010 16:52:17 +1300 Subject: [PATCH] Fix dropping unvalidated clients. --- OpenRA.Game/Server/Server.cs | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/OpenRA.Game/Server/Server.cs b/OpenRA.Game/Server/Server.cs index 7c14b6af63..daf905da4e 100644 --- a/OpenRA.Game/Server/Server.cs +++ b/OpenRA.Game/Server/Server.cs @@ -354,18 +354,23 @@ namespace OpenRA.Server public void DropClient(Connection toDrop) { - conns.Remove(toDrop); - SendChat(toDrop, "Connection Dropped"); + if (preConns.Contains(toDrop)) + preConns.Remove(toDrop); + else + { + conns.Remove(toDrop); + SendChat(toDrop, "Connection Dropped"); - if (GameStarted) - SendDisconnected(toDrop); /* Report disconnection */ + if (GameStarted) + SendDisconnected(toDrop); /* Report disconnection */ - lobbyInfo.Clients.RemoveAll(c => c.Index == toDrop.PlayerIndex); + lobbyInfo.Clients.RemoveAll(c => c.Index == toDrop.PlayerIndex); + + DispatchOrders( toDrop, toDrop.MostRecentFrame, new byte[] { 0xbf } ); - DispatchOrders( toDrop, toDrop.MostRecentFrame, new byte[] { 0xbf } ); - - if (conns.Count != 0) - SyncLobbyInfo(); + if (conns.Count != 0) + SyncLobbyInfo(); + } try {