Cleanup ratelimiter
This commit is contained in:
parent
2c27ab205c
commit
e94185681f
2 changed files with 14 additions and 14 deletions
|
|
@ -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{})
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue