diff --git a/Ragon.Server/Sources/Handler/AuthorizationOperation.cs b/Ragon.Server/Sources/Handler/AuthorizationOperation.cs index 5aa3759..27cdc7d 100644 --- a/Ragon.Server/Sources/Handler/AuthorizationOperation.cs +++ b/Ragon.Server/Sources/Handler/AuthorizationOperation.cs @@ -75,6 +75,8 @@ namespace Ragon.Server.Handler } else { + _logger.Warning($"Invalid key for connection {context.Connection.Id}"); + Reject(context); } } @@ -100,7 +102,7 @@ namespace Ragon.Server.Handler var sendData = _writer.ToArray(); context.Connection.Reliable.Send(sendData); - _logger.Trace($"Connection {context.Connection.Id} as {playerId}|{context.LobbyPlayer.Name} authorized"); + _logger.Trace($"Approved {context.Connection.Id} as {playerId}|{context.LobbyPlayer.Name}"); } public void Reject(RagonContext context) @@ -113,7 +115,7 @@ namespace Ragon.Server.Handler context.Connection.Reliable.Send(sendData); context.Connection.Close(); - _logger.Trace($"Connection {context.Connection.Id}"); + _logger.Trace($"Rejected Connectin:{context.Connection.Id}"); } } } \ No newline at end of file diff --git a/Ragon.Server/Sources/RagonServer.cs b/Ragon.Server/Sources/RagonServer.cs index f2ff4b8..743321c 100644 --- a/Ragon.Server/Sources/RagonServer.cs +++ b/Ragon.Server/Sources/RagonServer.cs @@ -66,7 +66,6 @@ public class RagonServer : IRagonServer, INetworkListener _timer = new Stopwatch(); var contextObserver = new RagonContextObserver(_contextsByPlayerId); - _scheduler.Run(new RagonActionTimer(SendRoomList, 2.0f)); _scheduler.Run(new RagonActionTimer(SendPlayerUserData, 0.1f)); _scheduler.Run(new RagonActionTimer(SendRoomUserData, 0.1f)); @@ -156,7 +155,9 @@ public class RagonServer : IRagonServer, INetworkListener _lobby.RemoveIfEmpty(room); } - _contextsByPlayerId.Remove(context.LobbyPlayer.Id); + + if (context.ConnectionStatus == ConnectionStatus.Authorized) + _contextsByPlayerId.Remove(context.LobbyPlayer.Id); _logger.Trace($"Disconnected: {connection.Id}"); } @@ -176,7 +177,9 @@ public class RagonServer : IRagonServer, INetworkListener room.DetachPlayer(context.RoomPlayer); _lobby.RemoveIfEmpty(room); } - _contextsByPlayerId.Remove(context.LobbyPlayer.Id); + + if (context.ConnectionStatus == ConnectionStatus.Authorized) + _contextsByPlayerId.Remove(context.LobbyPlayer.Id); _logger.Trace($"Timeout: {connection.Id}|{context.LobbyPlayer.Name}|{context.LobbyPlayer.Id}"); }