Пример #1
0
        private void CheckFlood()
        {
            if (ClientOptions.DOSProtection != null)
            {
                receiveRate++;

                //Time to check for receive rate
                if (DOSWatch.ElapsedMilliseconds >= ClientOptions.DOSProtection.Delta)
                {
                    DOSWatch.Restart();

                    //Check if we exeeded the maximum receive rate
                    if (receiveRate > ClientOptions.DOSProtection.MaxPackets)
                    {
                        DOSDetected?.Invoke(this);
                        receiveRate = 0;
                    }
                }
            }
        }
Пример #2
0
 private void ProtocolClient_DOSDetected(ProtocolClient sender)
 {
     DOSDetected?.Invoke(sender);
 }