From 5f0a91a12704e15f8c29d94ab59e8a39ff8e3fb6 Mon Sep 17 00:00:00 2001 From: Mathias Hall-Andersen Date: Sun, 11 Feb 2018 22:53:39 +0100 Subject: Moved ratelimiter to internal package --- device.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'device.go') 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") } -- cgit v1.2.3