Esempio n. 1
0
        protected bool StateServerIsAlive(StateServer server)
        {
            if (server.NeedsUpdate(HeartbeatInterval))
            {
                lock (Providers) {
                    Log.Debug("Checking availability of state server " + server.Address);

                    var result = Utilities.Network.CanConnect(server.Host, server.Port, TimeSpan.FromMilliseconds(Timeout));
                    server.IsAlive         = result;
                    server.LastStatusCheck = DateTime.UtcNow;

                    if (result)
                    {
                        Log.Debug("State server {0} is UP", server.Address);
                        server.LastKnownAlive = DateTime.UtcNow;
                    }
                    else
                    {
                        Log.Warn("State server {0} is DOWN. Was last alive at {1}", server.Address, server.LastKnownAlive);
                    }
                }
            }

            return(server.IsAlive);
        }
        protected bool StateServerIsAlive(StateServer server)
        {
            if (server.NeedsUpdate(HeartbeatInterval)) {

                lock (Providers) {

                    Log.Debug("Checking availability of state server " + server.Address);

                    var result = Utilities.Network.CanConnect(server.Host, server.Port, TimeSpan.FromMilliseconds(Timeout));
                    server.IsAlive = result;
                    server.LastStatusCheck = DateTime.UtcNow;

                    if (result) {
                        Log.Debug("State server {0} is UP", server.Address);
                        server.LastKnownAlive = DateTime.UtcNow;
                    }
                    else {
                        Log.Warn("State server {0} is DOWN. Was last alive at {1}", server.Address, server.LastKnownAlive);
                    }
                }
            }

            return server.IsAlive;
        }