summaryrefslogtreecommitdiffhomepage
path: root/device.go
diff options
context:
space:
mode:
authorMathias Hall-Andersen <mathias@hall-andersen.dk>2018-02-11 22:53:39 +0100
committerMathias Hall-Andersen <mathias@hall-andersen.dk>2018-02-11 22:53:39 +0100
commit5f0a91a12704e15f8c29d94ab59e8a39ff8e3fb6 (patch)
treed011e5cc1110f0231b361fae599befa70336d45c /device.go
parent1cf23c000540bac53324cffd864506c92077bf94 (diff)
Moved ratelimiter to internal package
Diffstat (limited to 'device.go')
-rw-r--r--device.go5
1 files changed, 3 insertions, 2 deletions
diff --git a/device.go b/device.go
index e288ebe..9f93f21 100644
--- a/device.go
+++ b/device.go
@@ -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")
}