diff options
Diffstat (limited to 'device/device.go')
-rw-r--r-- | device/device.go | 11 |
1 files changed, 0 insertions, 11 deletions
diff --git a/device/device.go b/device/device.go index c440679..9e2d001 100644 --- a/device/device.go +++ b/device/device.go @@ -27,7 +27,6 @@ type Device struct { // synchronized resources (locks acquired in order) state struct { - starting sync.WaitGroup stopping sync.WaitGroup sync.Mutex changing AtomicBool @@ -35,7 +34,6 @@ type Device struct { } net struct { - starting sync.WaitGroup stopping sync.WaitGroup sync.RWMutex bind conn.Bind // bind interface @@ -297,23 +295,18 @@ func NewDevice(tunDevice tun.Device, logger *Logger) *Device { // start workers cpus := runtime.NumCPU() - device.state.starting.Wait() device.state.stopping.Wait() for i := 0; i < cpus; i += 1 { - device.state.starting.Add(3) device.state.stopping.Add(3) go device.RoutineEncryption() go device.RoutineDecryption() go device.RoutineHandshake() } - device.state.starting.Add(2) device.state.stopping.Add(2) go device.RoutineReadFromTUN() go device.RoutineTUNEventReader() - device.state.starting.Wait() - return device } @@ -370,8 +363,6 @@ func (device *Device) Close() { return } - device.state.starting.Wait() - device.log.Info.Println("Device closing") device.state.changing.Set(true) device.state.Lock() @@ -527,11 +518,9 @@ func (device *Device) BindUpdate() error { // start receiving routines - device.net.starting.Add(2) device.net.stopping.Add(2) go device.RoutineReceiveIncoming(ipv4.Version, netc.bind) go device.RoutineReceiveIncoming(ipv6.Version, netc.bind) - device.net.starting.Wait() device.log.Debug.Println("UDP bind has been updated") } |