More robust solution to close deadlock
This commit is contained in:
parent
09a9bc2899
commit
a46401bbb1
3 changed files with 33 additions and 31 deletions
21
receive.go
21
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")
|
||||
}()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue