Example #1
0
        static void file_Changed(string path)
        {
            DCLogger.LogInfo(string.Format("Config file changed..[{0}]", path));
            cs.Reload();
            foreach (IConfig cfg in cs.Configs) //(string key in servers.Keys)
            {
                string configName = cfg.Name;
                if (servers.ContainsKey(configName))
                {
                    ServerCfg sc = getServerCfg(configName);
                    if (!sc.Equals(servers[configName].Cfg))
                    {
                        DCServer oldSrv = servers[configName];

                        DCServer server = new DCServer_Star(configName);
                        servers[configName] = server;

                        oldSrv.StopWork();
                        oldSrv = null;

                        servers[configName].StartWork();
                    }
                }
            }
        }
Example #2
0
 public static DCServer Instance(string configName)
 {
     if (!servers.ContainsKey(configName))
     {
         lock (servers)
         {
             if (!servers.ContainsKey(configName))
             {
                 ServerCfg cc = getServerCfg(configName);
                 servers.Add(configName, new DCServer_Star(configName));
             }
         }
     }
     return(servers[configName]);
 }
Example #3
0
        public static DCServer Instance(ServerCfg cfg)
        {
            string configName = cfg.ToString();

            if (!servers.ContainsKey(configName))
            {
                lock (servers)
                {
                    if (!servers.ContainsKey(configName))
                    {
                        servers.Add(configName, new DCServer_Star(cfg, configName));
                    }
                }
            }
            return(servers[configName]);
        }
Example #4
0
        internal static ServerCfg getServerCfg(string configName)
        {
            ServerCfg cc  = new ServerCfg();
            IConfig   cfg = cs.Configs[configName];

            cc.ServerR     = cfg.Get("ServerR");
            cc.ServerS     = cfg.Get("ServerS");
            cc.BindingType = cfg.Get("BindingType");
            //cc.MngAddr = cfg.Get("MngAddr");
            //cc.PubAddr = cfg.Get("PubAddr");
            //cc.SubAddr = cfg.Get("SubAddr");
            //cc.ReqAddr = cfg.Get("ReqAddr");
            //cc.ActAddr = cfg.Get("ActAddr");
            //cc.ActRply = cfg.Get("ActRply");
            //cc.SrvAddr = cfg.Get("SrvAddr");
            //cc.SrvRply = cfg.Get("SrvRply");
            //cc.SndAddr = cfg.Get("SndAddr");
            //cc.RcvAddr = cfg.Get("RcvAddr");
            return(cc);
        }
 internal DCServer_Star(ServerCfg serverCfg, string configName)
 {
     this.configName = configName;
     cfg             = serverCfg;
 }
 internal DCServer_Star(string configName)
 {
     this.configName = configName;
     cfg             = DCServer.getServerCfg(configName);
 }