Cleanup ratelimiter

This commit is contained in:
Jason A. Donenfeld
2018-05-13 18:42:06 +02:00
parent 2c27ab205c
commit e94185681f
2 changed files with 14 additions and 14 deletions

View File

@@ -185,7 +185,7 @@ func (device *Device) IsUnderLoad() bool {
now := time.Now()
underLoad := len(device.queue.handshake) >= UnderLoadQueueSize
if underLoad {
device.rate.underLoadUntil.Store(now.Add(time.Second))
device.rate.underLoadUntil.Store(now.Add(UnderLoadAfterTime))
return true
}
@@ -276,7 +276,7 @@ func NewDevice(tun TUNDevice, logger *Logger) *Device {
device.peers.keyMap = make(map[NoisePublicKey]*Peer)
// initialize anti-DoS / anti-scanning features
// initialize rate limiter
device.rate.limiter.Init()
device.rate.underLoadUntil.Store(time.Time{})