Example #1
0
        public override void Update()
        {
            var timeNow = Time.Get();

            if (timeNow >= LastSaltUpdate + 10 * Time.Freq())
            {
                CurrentSalt = (CurrentSalt + 1) % Salts.Length;
                Secure.RandomFill(Salts[CurrentSalt]);
                LastSaltUpdate = timeNow;
            }

            for (var clientId = 0; clientId < Connections.Length; clientId++)
            {
                Connections[clientId].Update();

                if (Connections[clientId].State == ConnectionState.ERROR)
                {
                    if (Time.Get() - Connections[clientId].ConnectedAt < Time.Freq())
                    {
                        NetworkBan.BanAddr(ClientEndPoint(clientId), 60, "Stressing network");
                    }
                    else
                    {
                        Drop(clientId, Connections[clientId].Error);
                    }
                }
            }
        }
Example #2
0
        public override void Update()
        {
            for (var i = 0; i < Connections.Count; i++)
            {
                Connections[i].Update();

                if (Connections[i].State == ConnectionState.Error)
                {
                    if (Time.Get() - Connections[i].ConnectedAt < Time.Freq())
                    {
                        NetworkBan.BanAddr(Connections[i].EndPoint, 60, "Stressing network");
                    }
                    else
                    {
                        Drop(i, Connections[i].Error);
                    }
                }
            }

            TokenManager.Update();
            TokenCache.Update();
        }