Ejemplo n.º 1
0
        public static void onRelaySvrPingMsg(CSPkg msg)
        {
            uint dwSeqNo = msg.stPkgData.stRelaySvrPing.dwSeqNo;

            Singleton <DataReportSys> .GetInstance().onRelaySvrPingMsg(dwSeqNo, Singleton <FrameSynchr> .instance.bActive && Singleton <FrameSynchr> .instance.bRunning, msg.stPkgData.stRelaySvrPing.dwTime);

            if (Singleton <FrameSynchr> .instance.bActive && Singleton <FrameSynchr> .instance.bRunning)
            {
                uint num = (uint)(Time.realtimeSinceStartup * 1000f) - msg.stPkgData.stRelaySvrPing.dwTime;
                Singleton <FrameSynchr> .instance.GameSvrPing = (int)((ulong)num + (ulong)((long)Singleton <FrameSynchr> .instance.GameSvrPing)) / 2;
                FrameSynchr.SetNetAccIPAndPort();
                if (NetworkAccelerator.Inited && !NetworkAccelerator.started && Time.unscaledTime - Singleton <FrameSynchr> .instance.m_NetAccPingTimeBegin > 1f)
                {
                    Singleton <FrameSynchr> .instance.m_NetAccPingTimeBegin = Time.unscaledTime;
                    NetworkAccelerator.OnNetDelay((int)num);
                }
                if (Singleton <DataReportSys> .GetInstance().HeartPingCount > 100 && Singleton <FrameSynchr> .instance.GameSvrPing > 300)
                {
                    FrameSynchr.RealPing();
                }
            }
            msg.Release();
        }
Ejemplo n.º 2
0
        public static void onRelaySvrPingMsg(CSPkg msg)
        {
            long num = (long)((ulong)msg.stPkgData.get_stRelaySvrPing().dwSeqNo);

            if (Singleton <FrameSynchr> .get_instance().m_LastReceiveHeartSeq <= 0L)
            {
                Singleton <FrameSynchr> .get_instance().m_LastReceiveHeartSeq = num;
            }
            else
            {
                long num2 = num - Singleton <FrameSynchr> .get_instance().m_LastReceiveHeartSeq;

                if (num2 >= 2L)
                {
                    Singleton <FrameSynchr> .get_instance().m_pingLost += num2;
                }
                Singleton <FrameSynchr> .get_instance().m_LastReceiveHeartSeq = num;
            }
            if (Singleton <FrameSynchr> .get_instance().bActive&& Singleton <FrameSynchr> .get_instance().bRunning)
            {
                uint num3 = (uint)(Time.realtimeSinceStartup * 1000f) - msg.stPkgData.get_stRelaySvrPing().dwTime;
                if (Singleton <FrameSynchr> .GetInstance().m_SendHeartSeq == num + 1L)
                {
                    Singleton <FrameSynchr> .get_instance().m_pingRecords.Add(num3);

                    Singleton <FrameSynchr> .get_instance().m_PingIdx += 1u;

                    Singleton <FrameSynchr> .get_instance().m_AvePing = (Singleton <FrameSynchr> .get_instance().m_AvePing *(Singleton <FrameSynchr> .get_instance().m_PingIdx - 1u) + num3) / Singleton <FrameSynchr> .get_instance().m_PingIdx;

                    Singleton <FrameSynchr> .get_instance().m_pingWobble.Add((uint)Mathf.Abs(num3 - Singleton <FrameSynchr> .get_instance().m_AvePing));

                    if (num3 > Singleton <FrameSynchr> .get_instance().m_MaxPing)
                    {
                        Singleton <FrameSynchr> .get_instance().m_MaxPing = num3;
                    }
                    if (num3 < Singleton <FrameSynchr> .get_instance().m_MinPing)
                    {
                        Singleton <FrameSynchr> .get_instance().m_MinPing = num3;
                    }
                    if (num3 > 300u)
                    {
                        Singleton <FrameSynchr> .get_instance().m_ping300Count += 1L;
                    }
                    if (num3 >= 150u && num3 <= 300u)
                    {
                        Singleton <FrameSynchr> .get_instance().m_ping150to300 += 1L;
                    }
                    else if (num3 < 150u)
                    {
                        Singleton <FrameSynchr> .get_instance().m_ping150 += 1L;
                    }
                }
                Singleton <FrameSynchr> .get_instance().GameSvrPing = (int)((ulong)num3 + (ulong)((long)Singleton <FrameSynchr> .get_instance().GameSvrPing)) / 2;

                FrameSynchr.SetNetAccIPAndPort();
                if (NetworkAccelerator.enabled && !NetworkAccelerator.started && Time.unscaledTime - Singleton <FrameSynchr> .get_instance().m_NetAccPingTimeBegin > 1f)
                {
                    Singleton <FrameSynchr> .get_instance().m_NetAccPingTimeBegin = Time.unscaledTime;

                    NetworkAccelerator.OnNetDelay((int)num3);
                }
                if (Time.unscaledTime - Singleton <FrameSynchr> .get_instance().m_PingTimeBegin > 5f)
                {
                    Singleton <FrameSynchr> .get_instance().m_PingTimeBegin = Time.unscaledTime;

                    if (Singleton <FrameSynchr> .get_instance().m_LastPing == 0u)
                    {
                        Singleton <FrameSynchr> .get_instance().m_LastPing = num3;
                    }
                    if (Math.Abs((long)((ulong)(Singleton <FrameSynchr> .get_instance().m_LastPing - num3))) > 100L)
                    {
                        Singleton <FrameSynchr> .get_instance().m_Abnormal_PingCount++;

                        Singleton <FrameSynchr> .get_instance().m_LastPing = num3;
                    }
                }
                if (Singleton <FrameSynchr> .get_instance().m_pingRecords.get_Count() > 100 && Singleton <FrameSynchr> .get_instance().GameSvrPing > 300)
                {
                    FrameSynchr.RealPing();
                }
            }
            msg.Release();
        }
Ejemplo n.º 3
0
        public static void onRelaySvrPingMsg(CSPkg msg)
        {
            long dwSeqNo = msg.stPkgData.stRelaySvrPing.dwSeqNo;

            if (Singleton <FrameSynchr> .instance.m_LastReceiveHeartSeq <= 0L)
            {
                Singleton <FrameSynchr> .instance.m_LastReceiveHeartSeq = dwSeqNo;
            }
            else
            {
                long num2 = dwSeqNo - Singleton <FrameSynchr> .instance.m_LastReceiveHeartSeq;
                if (num2 >= 2L)
                {
                    FrameSynchr instance = Singleton <FrameSynchr> .instance;
                    instance.m_pingLost += num2;
                }
                Singleton <FrameSynchr> .instance.m_LastReceiveHeartSeq = dwSeqNo;
            }
            if (Singleton <FrameSynchr> .instance.bActive && Singleton <FrameSynchr> .instance.bRunning)
            {
                uint num3 = ((uint)(Time.realtimeSinceStartup * 1000f)) - msg.stPkgData.stRelaySvrPing.dwTime;
                Singleton <FrameSynchr> .instance.m_pingRecords.Add((uint)Mathf.Clamp((float)num3, 0f, 1000f));

                FrameSynchr local2 = Singleton <FrameSynchr> .instance;
                local2.m_PingIdx++;
                Singleton <FrameSynchr> .instance.m_AvePing = ((Singleton <FrameSynchr> .instance.m_AvePing * (Singleton <FrameSynchr> .instance.m_PingIdx - 1)) + num3) / Singleton <FrameSynchr> .instance.m_PingIdx;
                Singleton <FrameSynchr> .instance.m_pingWobble.Add((uint)Mathf.Abs((float)(num3 - Singleton <FrameSynchr> .instance.m_AvePing)));

                if (num3 > Singleton <FrameSynchr> .instance.m_MaxPing)
                {
                    Singleton <FrameSynchr> .instance.m_MaxPing = num3;
                }
                if (num3 < Singleton <FrameSynchr> .instance.m_MinPing)
                {
                    Singleton <FrameSynchr> .instance.m_MinPing = num3;
                }
                if (num3 > 300)
                {
                    FrameSynchr local3 = Singleton <FrameSynchr> .instance;
                    local3.m_ping300Count += 1L;
                }
                if ((num3 >= 150) && (num3 <= 300))
                {
                    FrameSynchr local4 = Singleton <FrameSynchr> .instance;
                    local4.m_ping150to300 += 1L;
                }
                else if (num3 < 150)
                {
                    FrameSynchr local5 = Singleton <FrameSynchr> .instance;
                    local5.m_ping150 += 1L;
                }
                Singleton <FrameSynchr> .instance.GameSvrPing = (((int)num3) + Singleton <FrameSynchr> .instance.GameSvrPing) / 2;
                SetNetAccIPAndPort();
                if ((NetworkAccelerator.enabled && !NetworkAccelerator.started) && ((Time.unscaledTime - Singleton <FrameSynchr> .instance.m_NetAccPingTimeBegin) > 1f))
                {
                    Singleton <FrameSynchr> .instance.m_NetAccPingTimeBegin = Time.unscaledTime;
                    NetworkAccelerator.OnNetDelay((int)num3);
                }
                if ((Time.unscaledTime - Singleton <FrameSynchr> .instance.m_PingTimeBegin) > 5f)
                {
                    Singleton <FrameSynchr> .instance.m_PingTimeBegin = Time.unscaledTime;
                    if (Singleton <FrameSynchr> .instance.m_LastPing == 0)
                    {
                        Singleton <FrameSynchr> .instance.m_LastPing = num3;
                    }
                    if (Math.Abs((long)(Singleton <FrameSynchr> .instance.m_LastPing - num3)) > 100L)
                    {
                        FrameSynchr local6 = Singleton <FrameSynchr> .instance;
                        local6.m_Abnormal_PingCount++;
                        Singleton <FrameSynchr> .instance.m_LastPing = num3;
                    }
                }
                if ((Singleton <FrameSynchr> .instance.m_pingRecords.Count > 100) && (Singleton <FrameSynchr> .instance.GameSvrPing > 300))
                {
                    RealPing();
                }
                Singleton <FrameSynchr> .instance.PrepareReportPingToBeacon(Singleton <FrameSynchr> .instance.GameSvrPing);
            }
            msg.Release();
        }