]> git.ipfire.org Git - thirdparty/wireguard-go.git/commitdiff
device: remove device.state.stopping from RoutineDecryption
authorJosh Bleecher Snyder <josh@tailscale.com>
Tue, 19 Jan 2021 19:10:05 +0000 (11:10 -0800)
committerJosh Bleecher Snyder <josh@tailscale.com>
Mon, 8 Feb 2021 16:18:32 +0000 (08:18 -0800)
It is no longer necessary, as of 454de6f3e64abd2a7bf9201579cd92eea5280996
(device: use channel close to shut down and drain decryption channel).

Signed-off-by: Josh Bleecher Snyder <josh@tailscale.com>
device/device.go
device/receive.go

index d860ed39411ffb78614a451a24808f4f5262c83a..a7838b5c2fe36dfe409d4b1e3d2c5a5b3ae19405 100644 (file)
@@ -340,9 +340,9 @@ func NewDevice(tunDevice tun.Device, logger *Logger) *Device {
        cpus := runtime.NumCPU()
        device.state.stopping.Wait()
        for i := 0; i < cpus; i++ {
-               device.state.stopping.Add(2) // decryption and handshake
                go device.RoutineEncryption()
                go device.RoutineDecryption()
+               device.state.stopping.Add(1) // handshake
                go device.RoutineHandshake()
        }
 
index 0b70137ec7a093810ff8bc57b2c14a92200bfe1b..3b0f36c8c20a9527954b1eef48daed1ea705def1 100644 (file)
@@ -210,10 +210,8 @@ func (device *Device) RoutineReceiveIncoming(IP int, bind conn.Bind) {
 
 func (device *Device) RoutineDecryption() {
        var nonce [chacha20poly1305.NonceSize]byte
-       defer func() {
-               device.log.Verbosef("Routine: decryption worker - stopped")
-               device.state.stopping.Done()
-       }()
+
+       defer device.log.Verbosef("Routine: decryption worker - stopped")
        device.log.Verbosef("Routine: decryption worker - started")
 
        for elem := range device.queue.decryption.c {