mirror of
https://git.zx2c4.com/wireguard-go
synced 2024-11-15 01:05:15 +01:00
device: avoid deadlock when changing private key and removing self peers
Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
parent
8cc99631d0
commit
ace50a0529
@ -268,7 +268,9 @@ func (device *Device) SetPrivateKey(sk NoisePrivateKey) error {
|
||||
publicKey := sk.publicKey()
|
||||
for key, peer := range device.peers.keyMap {
|
||||
if peer.handshake.remoteStatic.Equals(publicKey) {
|
||||
peer.handshake.mutex.RUnlock()
|
||||
unsafeRemovePeer(device, peer, key)
|
||||
peer.handshake.mutex.RLock()
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user