예제 #1
0
        public void ReportProc()
        {
            List <IPStatisticsData> ipDataList = this.getCurrDataList();

            if (ipDataList != null && ipDataList.Count > 0)
            {
                int result = IPStatisticsClient.getInstance().IPStatisticsDataReport(IPStatisticsManager.lastMinite, ipDataList);
                LogManager.WriteLog(LogTypes.IPStatistics, string.Format("report ip data minite={0} count={1} result={2}", IPStatisticsManager.lastMinite, ipDataList.Count, result), null, true);
            }
        }
예제 #2
0
 public bool initialize(ICoreInterface coreInterface)
 {
     try
     {
         this.CoreInterface = coreInterface;
         if (!this.InitConfig())
         {
             return(false);
         }
         RemotingConfiguration.Configure(Process.GetCurrentProcess().MainModule.FileName + ".config", false);
         if (!HuanYingSiYuanClient.getInstance().initialize(coreInterface))
         {
             return(false);
         }
         if (!TianTiClient.getInstance().initialize(coreInterface))
         {
             return(false);
         }
         if (!YongZheZhanChangClient.getInstance().initialize(coreInterface))
         {
             return(false);
         }
         if (!KFCopyRpcClient.getInstance().initialize(coreInterface))
         {
             return(false);
         }
         if (!SpreadClient.getInstance().initialize(coreInterface))
         {
             return(false);
         }
         if (!AllyClient.getInstance().initialize(coreInterface))
         {
             return(false);
         }
         if (!IPStatisticsClient.getInstance().initialize(coreInterface))
         {
             return(false);
         }
         if (!JunTuanClient.getInstance().initialize(coreInterface))
         {
             return(false);
         }
         if (!KuaFuWorldClient.getInstance().initialize(coreInterface))
         {
             return(false);
         }
         GlobalEventSource.getInstance().registerListener(12, KuaFuManager.getInstance());
     }
     catch (Exception ex)
     {
         return(false);
     }
     return(true);
 }
예제 #3
0
 public void TimerProcForIP()
 {
     if (!GameManager.IsKuaFuServer)
     {
         long currTicks = TimeUtil.NOW();
         if (currTicks - IPStatisticsManager.updateTicks >= 30000L)
         {
             IPStatisticsManager.updateTicks = currTicks;
             int centerMinite = IPStatisticsClient.getInstance().RequestMinite();
             if (centerMinite != IPStatisticsManager.lastMinite)
             {
                 IPStatisticsManager.lastMinite = centerMinite;
                 this.RequestResult();
                 this.ReportProc();
             }
         }
     }
 }
예제 #4
0
        public void RequestResult()
        {
            long        currTicks     = TimeUtil.NOW();
            List <long> needDelIPList = new List <long>();

            lock (IPStatisticsManager.dictOperaMothod)
            {
                foreach (KeyValuePair <long, IPOperaData> ipData in IPStatisticsManager.dictOperaMothod)
                {
                    bool needDel = true;
                    if (this.isCanPassIP(ipData.Key))
                    {
                        needDel = true;
                    }
                    else
                    {
                        for (int i = 0; i < 4; i++)
                        {
                            if (ipData.Value.recvTicks + (long)(ipData.Value.OperaTime[i] * 1000) > currTicks)
                            {
                                needDel = false;
                                break;
                            }
                        }
                    }
                    if (needDel)
                    {
                        needDelIPList.Add(ipData.Key);
                    }
                }
                foreach (long ip in needDelIPList)
                {
                    IPStatisticsManager.dictOperaMothod.Remove(ip);
                }
            }
            List <IPOperaData> resultList = IPStatisticsClient.getInstance().GetIPStatisticsResult();

            LogManager.WriteLog(LogTypes.IPStatistics, string.Format("request ip data minite={0} count={1}", IPStatisticsManager.lastMinite, (resultList == null) ? 0 : resultList.Count), null, true);
            if (resultList != null && resultList.Count > 0)
            {
                lock (IPStatisticsManager.dictOperaMothod)
                {
                    foreach (IPOperaData ipData2 in resultList)
                    {
                        if (!this.isCanPassIP(ipData2.ipAsInt))
                        {
                            IPOperaData oldData = null;
                            if (IPStatisticsManager.dictOperaMothod.TryGetValue(ipData2.ipAsInt, out oldData))
                            {
                                for (int i = 0; i < 4; i++)
                                {
                                    if (currTicks + (long)(ipData2.OperaTime[i] * 1000) > oldData.recvTicks + (long)(oldData.OperaTime[i] * 1000))
                                    {
                                        oldData.recvTicks    = currTicks;
                                        oldData.OperaTime[i] = ipData2.OperaTime[i];
                                    }
                                }
                            }
                            else
                            {
                                ipData2.recvTicks = currTicks;
                                IPStatisticsManager.dictOperaMothod.Add(ipData2.ipAsInt, ipData2);
                            }
                            LogManager.WriteLog(LogTypes.IPStatistics, string.Format("recv need ip minite={0} ip={1}:{2} ", IPStatisticsManager.lastMinite, ipData2.ipAsInt, IpHelper.IntToIp(ipData2.ipAsInt)), null, true);
                        }
                    }
                }
            }
        }
예제 #5
0
 public bool startup()
 {
     try
     {
         ScheduleExecutor2.Instance.scheduleExecute(new NormalScheduleTask("HuanYingSiYuanClient.TimerProc", new EventHandler(HuanYingSiYuanClient.getInstance().TimerProc)), 2000, 2857);
         ScheduleExecutor2.Instance.scheduleExecute(new NormalScheduleTask("TianTiClient.TimerProc", new EventHandler(TianTiClient.getInstance().TimerProc)), 2000, 2857);
         ScheduleExecutor2.Instance.scheduleExecute(new NormalScheduleTask("YongZheZhanChangClient.TimerProc", new EventHandler(YongZheZhanChangClient.getInstance().TimerProc)), 2000, 3389);
         ScheduleExecutor2.Instance.scheduleExecute(new NormalScheduleTask("KFCopyRpcClient.TimerProc", new EventHandler(KFCopyRpcClient.getInstance().TimerProc)), 2000, 2732);
         ScheduleExecutor2.Instance.scheduleExecute(new NormalScheduleTask("SpreadClient.TimerProc", new EventHandler(SpreadClient.getInstance().TimerProc)), 2000, 4285);
         ScheduleExecutor2.Instance.scheduleExecute(new NormalScheduleTask("AllyClient.TimerProc", new EventHandler(AllyClient.getInstance().TimerProc)), 2000, 5714);
         ScheduleExecutor2.Instance.scheduleExecute(new NormalScheduleTask("IPStatisticsClient.TimerProc", new EventHandler(IPStatisticsClient.getInstance().TimerProc)), 2000, 5000);
         ScheduleExecutor2.Instance.scheduleExecute(new NormalScheduleTask("JunTuanClient.TimerProc", new EventHandler(JunTuanClient.getInstance().TimerProc)), 2000, 2500);
         ScheduleExecutor2.Instance.scheduleExecute(new NormalScheduleTask("KuaFuWorldClient.TimerProc", new EventHandler(KuaFuWorldClient.getInstance().TimerProc)), 2000, 3389);
         lock (this.RuntimeData.Mutex)
         {
             if (null == this.RuntimeData.BackGroundThread)
             {
                 this.RuntimeData.BackGroundThread = new Thread(new ThreadStart(this.BackGroudThreadProc));
                 this.RuntimeData.BackGroundThread.IsBackground = true;
                 this.RuntimeData.BackGroundThread.Start();
             }
         }
     }
     catch (Exception ex)
     {
         return(false);
     }
     return(true);
 }