示例#1
0
        public long GetPing()
        {
            long ticks = DateTime.Now.Ticks;
            int  num   = 0;
            long num2  = 0L;

            for (int i = 0; i < 10; i++)
            {
                PingStatisticInfo pingStatisticInfo = this.pingInfo[i];
                if ((i == 9 && pingStatisticInfo.tick != 0L) || (pingStatisticInfo.tick != 0L && ticks - pingStatisticInfo.tick < 10000000L))
                {
                    num2 += pingStatisticInfo.delayTime;
                    num++;
                }
            }
            long result;

            if (num == 0)
            {
                result = 0L;
            }
            else
            {
                result = num2 / (long)num;
            }
            return(result);
        }
示例#2
0
        private void SetCurPkgPing(int seqNo)
        {
            long        ticks       = DateTime.Now.Ticks;
            SendPkgData sendPkgData = this.sendArr[seqNo % 1000];

            if (sendPkgData != null)
            {
                long delayTime = ticks - sendPkgData.firstTimeTick;
                PingStatisticInfo pingStatisticInfo = this.pingInfo[this.curPingIdx % 9];
                pingStatisticInfo.tick      = ticks;
                pingStatisticInfo.delayTime = delayTime;
                this.curPingIdx++;
            }
        }
示例#3
0
        public void UpdatePing()
        {
            SendPkgData sendPkgData = this.sendArr[this.firstSeqNo % 1000];

            if (sendPkgData != null)
            {
                long num = DateTime.Now.Ticks - sendPkgData.firstTimeTick;
                if (num > this.channel.ping)
                {
                    PingStatisticInfo pingStatisticInfo = this.pingInfo[9];
                    pingStatisticInfo.delayTime = num;
                }
            }
        }