示例#1
0
        public void UpdateCMList(IEnumerable <ServerRecord> cmList)
        {
            var x = 0;

            foreach (var cm in cmList)
            {
                if (monitors.TryGetValue(cm.GetHost(), out var monitor))
                {
                    monitor.LastSeen = DateTime.Now;

                    continue;
                }

                var newMonitor = new Monitor(cm, SharedConfig);

                monitors.TryAdd(cm.GetHost(), newMonitor);

                _ = UpdateCMStatus(newMonitor, EResult.Pending, "New server");

                newMonitor.Connect(DateTime.Now + TimeSpan.FromSeconds(++x % 40));
            }

            if (x > 0)
            {
                Log.WriteInfo($"There are now {monitors.Count} monitors, added {x} new ones");
            }
        }
示例#2
0
        void HandleNewCMs(IPEndPoint[] newCms)
        {
            for (int x = 0; x < newCms.Length; ++x)
            {
                IPEndPoint newServer = newCms[x];

                var newMonitor = new Monitor(newServer);
                monitors[newServer] = newMonitor;

                newMonitor.Connect(DateTime.Now + TimeSpan.FromSeconds(x));
            }
        }
示例#3
0
        public void UpdateCMList(IEnumerable <ServerRecord> cmList)
        {
            var x = 0;

            foreach (var cm in cmList)
            {
                if (monitors.Keys.Any(s => s.Equals(cm)))
                {
                    continue;
                }

                var newMonitor = new Monitor(cm, SharedConfig);

                monitors.TryAdd(cm, newMonitor);

                _ = UpdateCMStatus(newMonitor, EResult.Invalid, "New server");

                newMonitor.Connect(DateTime.Now + TimeSpan.FromSeconds(++x % 40));
            }
        }
示例#4
0
        public void UpdateCMList(IEnumerable <ServerRecord> cmList)
        {
            var x = 0;

            foreach (var cm in cmList)
            {
                var monitor = monitors.Where(s => s.Key.Equals(cm)).ToArray();

                if (monitor.Length > 0)
                {
                    monitor[0].Value.LastSeen = DateTime.Now;

                    continue;
                }

                var newMonitor = new Monitor(cm, SharedConfig);

                monitors.TryAdd(cm, newMonitor);

                _ = UpdateCMStatus(newMonitor, EResult.Invalid, "New server");

                newMonitor.Connect(DateTime.Now + TimeSpan.FromSeconds(++x % 40));
            }
        }
        void HandleNewCMs( IPEndPoint[] newCms )
        {
            for ( int x = 0 ; x < newCms.Length ; ++x )
            {
                IPEndPoint newServer = newCms[ x ];

                var newMonitor = new Monitor( newServer );
                monitors[ newServer ] = newMonitor;

                newMonitor.Connect( DateTime.Now + TimeSpan.FromSeconds( x ) );
            }
        }