diff options
Diffstat (limited to 'src/send.go')
-rw-r--r-- | src/send.go | 25 |
1 files changed, 7 insertions, 18 deletions
diff --git a/src/send.go b/src/send.go index e9dfb54..5c88ead 100644 --- a/src/send.go +++ b/src/send.go @@ -303,27 +303,16 @@ func (device *Device) RoutineEncryption() { } } - // encrypt content (append to header) + // encrypt content and release to consumer binary.LittleEndian.PutUint64(nonce[4:], elem.nonce) - elem.keyPair.send.mutex.RLock() - if elem.keyPair.send.aead == nil { - // very unlikely (the key was deleted during queuing) - elem.Drop() - } else { - elem.packet = elem.keyPair.send.aead.Seal( - header, - nonce[:], - elem.packet, - nil, - ) - } + elem.packet = elem.keyPair.send.Seal( + header, + nonce[:], + elem.packet, + nil, + ) elem.mutex.Unlock() - elem.keyPair.send.mutex.RUnlock() - - // refresh key if necessary - - elem.peer.KeepKeyFreshSending() } } } |