Пример #1
0
        public PingerStats GetStats()
        {
            PingerStats stats = new PingerStats();

            int timeNow = Utils.UnixTimeStamp();

            int iTotal = 0;

            lock (Engine.Servers)
            {
                foreach (ServerInfo infoServer in Engine.Servers.Values)
                {
                    int deltaValid = GetPingerDelayValid(infoServer);

                    if ((stats.OlderCheckDate == 0) || (stats.OlderCheckDate > infoServer.LastPingResult))
                    {
                        stats.OlderCheckDate = infoServer.LastPingResult;
                    }

                    if ((stats.LatestCheckDate == 0) || (stats.LatestCheckDate < infoServer.LastPingResult))
                    {
                        stats.LatestCheckDate = infoServer.LastPingResult;
                    }

                    iTotal++;
                    if (timeNow - infoServer.LastPingResult > deltaValid)
                    {
                        stats.Invalid++;
                    }
                }
            }

            //Console.WriteLine("Ping Total:" + iTotal.ToString() + ", Invalid:" + iInvalid.ToString());

            stats.Valid = (stats.Invalid == 0);

            return(stats);
        }
Пример #2
0
        public PingerStats GetStats()
        {
            PingerStats stats = new PingerStats();

            int timeNow = Utils.UnixTimeStamp();

            int iTotal = 0;

            lock (Engine.Connections)
            {
                foreach (ConnectionInfo infoConnection in Engine.Connections.Values)
                {
                    int deltaValid = GetPingerDelayValid(infoConnection);

                    if ((stats.OlderCheckDate == 0) || (stats.OlderCheckDate > infoConnection.LastPingResult))
                    {
                        stats.OlderCheckDate = infoConnection.LastPingResult;
                    }

                    if ((stats.LatestCheckDate == 0) || (stats.LatestCheckDate < infoConnection.LastPingResult))
                    {
                        stats.LatestCheckDate = infoConnection.LastPingResult;
                    }

                    iTotal++;
                    if ((infoConnection.CanPing()) && (timeNow - infoConnection.LastPingResult > deltaValid))
                    {
                        stats.Invalid++;
                    }
                }
            }

            stats.Valid = (stats.Invalid == 0);

            return(stats);
        }
Пример #3
0
        public PingerStats GetStats()
        {
            PingerStats stats = new PingerStats();

            int timeNow = Utils.UnixTimeStamp();

            int iTotal = 0;

            lock (Engine.Servers)
            {
                foreach (ServerInfo infoServer in Engine.Servers.Values)
                {
                    int deltaValid = GetPingerDelayValid(infoServer);

                    if ( (stats.OlderCheckDate == 0) || (stats.OlderCheckDate > infoServer.LastPingResult) )
                        stats.OlderCheckDate = infoServer.LastPingResult;

                    if ((stats.LatestCheckDate == 0) || (stats.LatestCheckDate < infoServer.LastPingResult))
                        stats.LatestCheckDate = infoServer.LastPingResult;

                    iTotal++;
                    if (timeNow - infoServer.LastPingResult > deltaValid)
                        stats.Invalid++;
                }
            }

            stats.Valid = (stats.Invalid == 0);

            return stats;
        }