mirror of
https://git.zx2c4.com/wireguard-go
synced 2024-11-15 01:05:15 +01:00
device: remove device.state.stopping from RoutineDecryption
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>
This commit is contained in:
parent
4192036acd
commit
84a42aed63
@ -340,9 +340,9 @@ func NewDevice(tunDevice tun.Device, logger *Logger) *Device {
|
|||||||
cpus := runtime.NumCPU()
|
cpus := runtime.NumCPU()
|
||||||
device.state.stopping.Wait()
|
device.state.stopping.Wait()
|
||||||
for i := 0; i < cpus; i++ {
|
for i := 0; i < cpus; i++ {
|
||||||
device.state.stopping.Add(2) // decryption and handshake
|
|
||||||
go device.RoutineEncryption()
|
go device.RoutineEncryption()
|
||||||
go device.RoutineDecryption()
|
go device.RoutineDecryption()
|
||||||
|
device.state.stopping.Add(1) // handshake
|
||||||
go device.RoutineHandshake()
|
go device.RoutineHandshake()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -210,10 +210,8 @@ func (device *Device) RoutineReceiveIncoming(IP int, bind conn.Bind) {
|
|||||||
|
|
||||||
func (device *Device) RoutineDecryption() {
|
func (device *Device) RoutineDecryption() {
|
||||||
var nonce [chacha20poly1305.NonceSize]byte
|
var nonce [chacha20poly1305.NonceSize]byte
|
||||||
defer func() {
|
|
||||||
device.log.Verbosef("Routine: decryption worker - stopped")
|
defer device.log.Verbosef("Routine: decryption worker - stopped")
|
||||||
device.state.stopping.Done()
|
|
||||||
}()
|
|
||||||
device.log.Verbosef("Routine: decryption worker - started")
|
device.log.Verbosef("Routine: decryption worker - started")
|
||||||
|
|
||||||
for elem := range device.queue.decryption.c {
|
for elem := range device.queue.decryption.c {
|
||||||
|
Loading…
Reference in New Issue
Block a user