summaryrefslogtreecommitdiffhomepage
path: root/device
diff options
context:
space:
mode:
Diffstat (limited to 'device')
-rw-r--r--device/device.go5
-rw-r--r--device/receive.go15
2 files changed, 18 insertions, 2 deletions
diff --git a/device/device.go b/device/device.go
index 3172224..d37fe6f 100644
--- a/device/device.go
+++ b/device/device.go
@@ -371,7 +371,10 @@ func (device *Device) FlushPacketQueues() {
select {
case elem, ok := <-device.queue.decryption:
if ok {
- elem.Drop()
+ if !elem.IsDropped() {
+ elem.Drop()
+ device.PutMessageBuffer(elem.buffer)
+ }
}
case <-device.queue.handshake:
default:
diff --git a/device/receive.go b/device/receive.go
index 4b6f278..0bd22bf 100644
--- a/device/receive.go
+++ b/device/receive.go
@@ -251,7 +251,20 @@ func (device *Device) RoutineDecryption() {
for {
select {
case <-device.signals.stop:
- return
+ for {
+ select {
+ case elem, ok := <-device.queue.decryption:
+ if ok {
+ if !elem.IsDropped() {
+ elem.Drop()
+ device.PutMessageBuffer(elem.buffer)
+ }
+ elem.Unlock()
+ }
+ default:
+ return
+ }
+ }
case elem, ok := <-device.queue.decryption: