Esempio n. 1
0
        public static void Test(Server s)
        {
            DateTime start = DateTime.Now;
            DateTime timeout = DateTime.Now.Add(Timeout);
            s.SendCommand("whitelist");
            while (true)
            {
                if (s.LastReceived > start)
                    break;
#if DEBUG
                Console.WriteLine("Watchdog waiting");
#endif
                if (DateTime.Now < timeout)
                {
                    System.Threading.Thread.Sleep(100);
                    continue;
                }
                //Triggered
                BackendManager.Log(new Exception("Watchdog: " + s.Name));
                s.Kill();
                break;
            }
        }
Esempio n. 2
0
        public static Server StartServer(string name)
        {
            lock (servers)
            {
                Server s = GetServer(name);
                if (s != null)
                    return s;

                if (Directory.Exists(name) == false)
                    throw new InvalidArgumentException("Missing directory: " + name);

                s = new Server(name);
                servers.Add(name, s);
                s.Start();
                SendToClients(RunningServers());
                return s;
            }
        }