public static void RemoveConnection(GameSession s) { lock (Connections) { if (Connections.ContainsKey(s.SessionId)) Connections.Remove(s.SessionId); else Debug.Assert(false, "Unidentified session"); } OnConnectionLost(); }
public static void AddConnection(Socket s) { UInt32 nextId = CreateSessionId(); GameSession session = new GameSession(new TcpConnection(s) { socketId = ++SocketCount }) { SessionId = nextId }; lock (Connections) Connections.Add(nextId, session); if (OnConnectionAdded != null) OnConnectionAdded(); Log.Write("Added new connection: " + s.RemoteEndPoint.ToString()); }
public static void RemoveConnection(GameSession s) { lock (Connections) Connections.Remove(s); OnConnectionLost(); }