static ControllerConfig GetConfig() { if (ConfigCache == null) { ConfigCache = ControllerConfig.ReadConfig(ConfigPath); } return(ConfigCache); }
static void Main(string[] args) { if (args.Length > 0) { ConfigPath = args[0]; } else { ConfigPath = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "NodeController.cfg.xml"); } // load config var cfg = ControllerConfig.ReadConfig(ConfigPath); // setup control listener InboundControlListener = new JsonMessageHost(); InboundControlListener.MessageProcessor = HandleControllMessage; InboundControlListener.Prefixes.AddRange(cfg.ListenPrefixes.ToArray()); InboundControlListener.Startup(); while (!Done()) { lock (Nodes) { foreach (var node in Nodes) { if (node.Alive) { } else { // notify them that the node died } } } Thread.Sleep(100); } InboundControlListener.Shutdown(); }