Esempio n. 1
0
        private void RegisterTracker(string key, PingTracker tracker)
        {
            // Info block registration
            this.trackerInfos.Add(key, new TrackerInfo {
                Tracker = tracker
            });

            // Event forwarding
            tracker.OnPingUpdated += payload =>
            {
                this.trackerInfos[key].Ticked  = true;
                this.trackerInfos[key].LastRTT = payload.LastRTT;
            };
        }
Esempio n. 2
0
        private PingTracker GetBestTracker()
        {
            var         bestPing    = 0UL;
            PingTracker bestTracker = null;

            foreach (var tracker in this.pingTrackers)
            {
                if (tracker.LastRTT >= bestPing)
                {
                    bestPing    = tracker.LastRTT;
                    bestTracker = tracker;
                }
            }
            return(bestTracker);
        }