summaryrefslogtreecommitdiffhomepage
path: root/receive.go
diff options
context:
space:
mode:
authorJason A. Donenfeld <Jason@zx2c4.com>2018-05-05 06:00:38 +0200
committerJason A. Donenfeld <Jason@zx2c4.com>2018-05-05 06:00:38 +0200
commita46401bbb151d8f1e662dc16b612426352138c1e (patch)
tree4fa4b0ac6777c8fca2c300bbae1323056bb5e47e /receive.go
parent09a9bc289990e3f377a331626b0102283d6f83f4 (diff)
More robust solution to close deadlock
Diffstat (limited to 'receive.go')
-rw-r--r--receive.go21
1 files changed, 2 insertions, 19 deletions
diff --git a/receive.go b/receive.go
index dc6488f..e323c6d 100644
--- a/receive.go
+++ b/receive.go
@@ -238,17 +238,7 @@ func (device *Device) RoutineDecryption() {
logDebug := device.log.Debug
defer func() {
- for {
- select {
- case elem, ok := <-device.queue.decryption:
- if ok {
- elem.Drop()
- }
- default:
- goto out
- }
- }
- out:
+ device.state.stopping.Done()
logDebug.Println("Routine: decryption worker - stopped")
}()
logDebug.Println("Routine: decryption worker - started")
@@ -314,14 +304,7 @@ func (device *Device) RoutineHandshake() {
logDebug := device.log.Debug
defer func() {
- for {
- select {
- case <-device.queue.handshake:
- default:
- goto out
- }
- }
- out:
+ device.state.stopping.Done()
logDebug.Println("Routine: handshake worker - stopped")
}()