Odds and ends
This commit is contained in:
parent
e94185681f
commit
2326d6a4d7
16 changed files with 139 additions and 164 deletions
26
receive.go
26
receive.go
|
|
@ -600,20 +600,24 @@ func (peer *Peer) RoutineSequentialReceiver() {
|
|||
// check if using new key-pair
|
||||
|
||||
kp := &peer.keypairs
|
||||
kp.mutex.Lock() //TODO: make this into an RW lock to reduce contention here for the equality check which is rarely true
|
||||
if kp.next == elem.keypair {
|
||||
old := kp.previous
|
||||
kp.previous = kp.current
|
||||
device.DeleteKeypair(old)
|
||||
kp.current = kp.next
|
||||
kp.next = nil
|
||||
peer.timersHandshakeComplete()
|
||||
select {
|
||||
case peer.signals.newKeypairArrived <- struct{}{}:
|
||||
default:
|
||||
kp.mutex.Lock()
|
||||
if kp.next != elem.keypair {
|
||||
kp.mutex.Unlock()
|
||||
} else {
|
||||
old := kp.previous
|
||||
kp.previous = kp.current
|
||||
device.DeleteKeypair(old)
|
||||
kp.current = kp.next
|
||||
kp.next = nil
|
||||
kp.mutex.Unlock()
|
||||
peer.timersHandshakeComplete()
|
||||
select {
|
||||
case peer.signals.newKeypairArrived <- struct{}{}:
|
||||
default:
|
||||
}
|
||||
}
|
||||
}
|
||||
kp.mutex.Unlock()
|
||||
|
||||
peer.keepKeyFreshReceiving()
|
||||
peer.timersAnyAuthenticatedPacketTraversal()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue