protected virtual void Initialize()
        {
            if (CommonSettings.Default.EnablePerformanceCounters)
            {
                this.InitCorePerformanceCounters();
                CustomAuthResultCounters.Initialize();
            }
            else
            {
                log.Info("Performance counters are disabled");
            }

            this.GameServers  = new GameServerContextManager(this, MasterServerSettings.Default.GSContextTTL);
            this.LoadBalancer = new LoadBalancer <GameServerContext>(Path.Combine(this.ApplicationRootPath, "LoadBalancer.config"));

            this.DefaultApplication = new GameApplication("{Default}", "{Default}", this.LoadBalancer);

            this.CustomAuthHandler = new CustomAuthHandler(new HttpRequestQueueCountersFactory());
            this.CustomAuthHandler.InitializeFromConfig();

            if (MasterServerSettings.Default.AppStatsPublishInterval > 0)
            {
                AppStats = new ApplicationStats(MasterServerSettings.Default.AppStatsPublishInterval);
            }

            //            CounterPublisher.DefaultInstance.AddStaticCounterClass(typeof(LoadBalancerCounter), this.ApplicationName);

            this.InitResolver();
        }
Esempio n. 2
0
        protected virtual void Initialize()
        {
            if (CommonSettings.Default.EnablePerformanceCounters)
            {
                HttpQueuePerformanceCounters.Initialize();
                CustomAuthResultCounters.Initialize();
            }
            else
            {
                log.Info("Performance counters are disabled");
            }

            this.GameServers  = new GameServerCollection();
            this.LoadBalancer = new LoadBalancer <IncomingGameServerPeer>(Path.Combine(this.ApplicationRootPath, "LoadBalancer.config"));

            this.DefaultApplication = new GameApplication("{Default}", "{Default}", this.LoadBalancer);

            this.CustomAuthHandler = new CustomAuthHandler(new HttpRequestQueueCountersFactory());
            this.CustomAuthHandler.InitializeFromConfig();

            if (MasterServerSettings.Default.AppStatsPublishInterval > 0)
            {
                AppStats = new ApplicationStats(MasterServerSettings.Default.AppStatsPublishInterval);
            }

            this.InitResolver();
        }
Esempio n. 3
0
        protected virtual void Initialize()
        {
            WebRequest.DefaultWebProxy = null;

            log.Info("Initializing ...");

            log.Info("ServicePointManager.DefaultConnectionLimit=" + ServicePointManager.DefaultConnectionLimit);

            this.SetupTokenCreator();

            AppDomain.CurrentDomain.UnhandledException += CurrentDomainOnUnhandledException;

            Protocol.RegisterTypeMapper(new UnknownTypeMapper());

            if (Settings.Default.EnablePerformanceCounters)
            {
                this.InitCorePerformanceCounters();
                CustomAuthResultCounters.Initialize();
            }
            else
            {
                log.Info("Performance counters are disabled");
            }

            // load nameserver config & initialize file watcher
            if (!string.IsNullOrEmpty(this.ApplicationRootPath) && Directory.Exists(this.ApplicationRootPath))
            {
                this.fileWatcher                     = new FileSystemWatcher(this.ApplicationRootPath, Settings.Default.NameServerConfig);
                this.fileWatcher.Changed            += this.ConfigFileChanged;
                this.fileWatcher.Created            += this.ConfigFileChanged;
                this.fileWatcher.Renamed            += this.ConfigFileChanged;
                this.fileWatcher.EnableRaisingEvents = true;
            }

            string message;

            if (!this.ReadNameServerConfigurationFile(out message))
            {
                log.Error(message);
                throw new ConfigurationException(message);
            }

            this.CustomAuthHandler = new CustomAuthHandler(new HttpRequestQueueCountersFactory());
            this.CustomAuthHandler.InitializeFromConfig();
        }