diff options
author | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2017-07-13 14:32:40 +0200 |
---|---|---|
committer | Mathias Hall-Andersen <mathias@hall-andersen.dk> | 2017-07-13 14:32:40 +0200 |
commit | 93e3848ea76e755477bec8d9540a3c4c31ea7320 (patch) | |
tree | 31c27266ebf12fa9cef06ab531ee4b9fa7b69c56 /src/device.go | |
parent | 8393cbff521560caef5b1b468cbb2ad030e8eda4 (diff) |
Terminate on interface deletion
Program now terminates when the interface is removed
Increases the number of os threads (relevant for Go <1.5, not tested)
More consistent commenting
Improved logging (additional peer information)
Diffstat (limited to 'src/device.go')
-rw-r--r-- | src/device.go | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/src/device.go b/src/device.go index a26cc7b..b272544 100644 --- a/src/device.go +++ b/src/device.go @@ -98,9 +98,9 @@ func NewDevice(tun TUNDevice, logLevel int) *Device { } go device.RoutineBusyMonitor() + go device.RoutineWriteToTUN(tun) go device.RoutineReadFromTUN(tun) go device.RoutineReceiveIncomming() - go device.RoutineWriteToTUN(tun) go device.ratelimiter.RoutineGarbageCollector(device.signal.stop) return device @@ -141,5 +141,8 @@ func (device *Device) RemoveAllPeers() { func (device *Device) Close() { device.RemoveAllPeers() close(device.signal.stop) - close(device.queue.encryption) +} + +func (device *Device) Wait() { + <-device.signal.stop } |