Fixed deadlock in index.go

This commit is contained in:
Mathias Hall-Andersen
2017-07-17 16:16:18 +02:00
parent dd4da93749
commit c5d7efc246
8 changed files with 194 additions and 152 deletions

View File

@@ -212,18 +212,18 @@ func (device *Device) RoutineReceiveIncomming() {
// add to peer queue
peer := value.peer
work := &QueueInboundElement{
elem := &QueueInboundElement{
packet: packet,
buffer: buffer,
keyPair: keyPair,
dropped: AtomicFalse,
}
work.mutex.Lock()
elem.mutex.Lock()
// add to decryption queues
device.addToInboundQueue(device.queue.decryption, work)
device.addToInboundQueue(peer.queue.inbound, work)
device.addToInboundQueue(device.queue.decryption, elem)
device.addToInboundQueue(peer.queue.inbound, elem)
buffer = nil
default: