Ejemplo n.º 1
0
 /// <summary>
 /// Cleans all the chat roomsDeletes the empty chat rooms
 /// </summary>
 /// <param name="state"></param>
 public static void CleanChatRooms(object state)
 {
     lock (Rooms)
     {
         foreach (object key in Rooms.Keys)
         {
             ChatRoom room = Rooms[key.ToString()];
             room.ExpireUsers(userChatRoomSessionTimeout);
             if (room.IsEmpty())
             {
                 room.Dispose();
                 Rooms.Remove(key.ToString());
             }
         }
     }
 }
Ejemplo n.º 2
0
        /// <summary>

        /// Deletes the empty chat rooms

        /// </summary>

        /// <param name="state"></param>

        public static void CleanChatRooms(object state)

        {
            Monitor.Enter(Rooms);

            foreach (object key in Rooms.Keys)

            {
                ChatRoom room = (ChatRoom)Rooms[key.ToString()];

                room.ExpireUsers(100);

                if (room.IsEmpty())

                {
                    room.Dispose();

                    Rooms.Remove(key.ToString());
                }
            }

            Monitor.Exit(Rooms);
        }