Example #1
0
 public static void RemoveConnection(GameSession s)
 {
     lock (Connections)
     {
         if (Connections.ContainsKey(s.SessionId))
             Connections.Remove(s.SessionId);
         else
             Debug.Assert(false, "Unidentified session");
     }
     OnConnectionLost();
 }
Example #2
0
        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());
        }
Example #3
0
 public static void RemoveConnection(GameSession s)
 {
     lock (Connections)
         Connections.Remove(s);
     OnConnectionLost();
 }