Beispiel #1
0
        public static void Main(string[] args)
        {
            Thread T = new Thread(() =>
            {
                UCSControl.WelcomeMessage();
                CheckThread.Start();
                MemoryThread.Start();
                NetworkThread.Start();
                ParserThread.Start();
            }); T.Start();

            T.Priority = ThreadPriority.Highest;
        }
Beispiel #2
0
        public static void Main(string[] args)
        {
            // Print welcome message.
            UCSControl.WelcomeMessage();

            // Check directories and files.
            DirectoryChecker.CheckDirectories();
            DirectoryChecker.CheckFiles();

            // Initialize our stuff.
            CSVManager.Initialize();
            ResourcesManager.Initialize();
            ObjectManager.Initialize();

            Logger.Initialize();
            ExceptionLogger.Initialize();

            WebApi.Initialize();
            Gateway.Initialize();

            // Start listening since we're done initializing.
            Gateway.Listen();

            while (true)
            {
                const int SLEEP_TIME = 5000;

                var numDisc = 0;
                var clients = ResourcesManager.GetConnectedClients();
                for (int i = 0; i < clients.Count; i++)
                {
                    var client = clients[i];
                    if (DateTime.Now > client.NextKeepAlive)
                    {
                        ResourcesManager.DropClient(client.GetSocketHandle());
                        numDisc++;
                    }
                }

                if (numDisc > 0)
                {
                    Logger.Say($"Dropped {numDisc} clients due to keep alive timeouts.");
                }

                Thread.Sleep(SLEEP_TIME);
            }
        }