Fixed deadlock in index.go
This commit is contained in:
parent
dd4da93749
commit
c5d7efc246
8 changed files with 194 additions and 152 deletions
|
|
@ -459,7 +459,8 @@ func (peer *Peer) NewKeyPair() *KeyPair {
|
|||
|
||||
// remap index
|
||||
|
||||
peer.device.indices.Insert(handshake.localIndex, IndexTableEntry{
|
||||
indices := &peer.device.indices
|
||||
indices.Insert(handshake.localIndex, IndexTableEntry{
|
||||
peer: peer,
|
||||
keyPair: keyPair,
|
||||
handshake: nil,
|
||||
|
|
@ -476,7 +477,7 @@ func (peer *Peer) NewKeyPair() *KeyPair {
|
|||
if kp.previous != nil {
|
||||
kp.previous.send = nil
|
||||
kp.previous.receive = nil
|
||||
peer.device.indices.Delete(kp.previous.localIndex)
|
||||
indices.Delete(kp.previous.localIndex)
|
||||
}
|
||||
kp.previous = kp.current
|
||||
kp.current = keyPair
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue