diff options
author | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2018-02-11 22:53:39 +0100 |
---|---|---|
committer | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2018-02-11 22:53:39 +0100 |
commit | 5f0a91a12704e15f8c29d94ab59e8a39ff8e3fb6 (patch) | |
tree | d011e5cc1110f0231b361fae599befa70336d45c /device.go | |
parent | 1cf23c000540bac53324cffd864506c92077bf94 (diff) |
Moved ratelimiter to internal package
Diffstat (limited to 'device.go')
-rw-r--r-- | device.go | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -1,6 +1,7 @@ package main import ( + "git.zx2c4.com/wireguard-go/internal/ratelimiter" "runtime" "sync" "sync/atomic" @@ -50,7 +51,7 @@ type Device struct { rate struct { underLoadUntil atomic.Value - limiter Ratelimiter + limiter ratelimiter.Ratelimiter } pool struct { @@ -300,7 +301,6 @@ func NewDevice(tun TUNDevice, logger *Logger) *Device { go device.RoutineReadFromTUN() go device.RoutineTUNEventReader() - go device.rate.limiter.RoutineGarbageCollector(device.signal.stop) return device } @@ -355,6 +355,7 @@ func (device *Device) Close() { device.BindClose() device.isUp.Set(false) device.RemoveAllPeers() + device.rate.limiter.Close() device.log.Info.Println("Interface closed") } |