Пример #1
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();
        }
Пример #2
0
        protected override void Setup()
        {
            this.InitLogging();

            log.InfoFormat("Setup: serverId={0}", ServerId);

            Protocol.AllowRawCustomValues = true;
            Protocol.RegisterTypeMapper(new UnknownTypeMapper());

            this.PublicIpAddress     = PublicIPAddressReader.ParsePublicIpAddress(GameServerSettings.Default.PublicIPAddress);
            this.PublicIpAddressIPv6 = string.IsNullOrEmpty(GameServerSettings.Default.PublicIPAddressIPv6) ? null : IPAddress.Parse(GameServerSettings.Default.PublicIPAddressIPv6);

            this.IsMaster = PublicIPAddressReader.IsLocalIpAddress(this.MasterEndPoint.Address) || this.MasterEndPoint.Address.Equals(this.PublicIpAddress);

            Counter.IsMasterServer.RawValue = this.IsMaster ? 1 : 0;

            this.GameCache = new GameCache(this);

            if (CommonSettings.Default.EnablePerformanceCounters)
            {
                HttpQueuePerformanceCounters.Initialize();
            }
            else
            {
                log.Info("Performance counters are disabled");
            }

            this.SetupTokenCreator();
            this.SetupFeedbackControlSystem();
            this.SetupServerStateMonitor();
            this.SetupMasterConnection();

            if (GameServerSettings.Default.AppStatsPublishInterval > 0)
            {
                this.AppStatsPublisher = new ApplicationStatsPublisher(this, GameServerSettings.Default.AppStatsPublishInterval);
            }

            CounterPublisher.DefaultInstance.AddStaticCounterClass(typeof(Hive.Diagnostics.Counter), this.ApplicationName);
            CounterPublisher.DefaultInstance.AddStaticCounterClass(typeof(Counter), this.ApplicationName);

            this.executionFiber = new PoolFiber();
            this.executionFiber.Start();
            this.executionFiber.ScheduleOnInterval(this.CheckGames, 60000, 60000);
        }
Пример #3
0
        /// <summary>
        /// Application initializtion.
        /// </summary>
        protected override void Setup()
        {
            log4net.GlobalContext.Properties["Photon:ApplicationLogPath"] = Path.Combine(this.ApplicationRootPath, "log");

            // log4net
            string path = Path.Combine(this.BinaryPath, "log4net.config");
            var    file = new FileInfo(path);

            if (file.Exists)
            {
                LogManager.SetLoggerFactory(Log4NetLoggerFactory.Instance);
                XmlConfigurator.ConfigureAndWatch(file);
            }

            log.InfoFormat("Created application Instance: type={0}", Instance.GetType());

            HttpQueuePerformanceCounters.Initialize();
            Initialize();
        }
Пример #4
0
 public HttpRequestQueueCounters(string instanceName)
 {
     this.instance = HttpQueuePerformanceCounters.GetInstance(instanceName);
 }
Пример #5
0
 static HttpRequestQueueCounters()
 {
     _Total = HttpQueuePerformanceCounters.GetInstance("_Total");
 }