mirror of
https://github.com/tailscale/tailscale.git
synced 2025-01-05 23:07:44 +00:00
wgengine: reduce critical section
No need to hold wgLock while using the device to LookupPeer; that has its own mutex already. Updates #cleanup Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com> Change-Id: Ib56049fcc7163cf5a2c2e7e12916f07b4f9d67cb
This commit is contained in:
parent
9a8c2f47f2
commit
219efebad4
@ -1012,12 +1012,13 @@ func (e *userspaceEngine) getStatusCallback() StatusCallback {
|
||||
|
||||
func (e *userspaceEngine) getPeerStatusLite(pk key.NodePublic) (status ipnstate.PeerStatusLite, ok bool) {
|
||||
e.wgLock.Lock()
|
||||
if e.wgdev == nil {
|
||||
e.wgLock.Unlock()
|
||||
dev := e.wgdev
|
||||
e.wgLock.Unlock()
|
||||
|
||||
if dev == nil {
|
||||
return status, false
|
||||
}
|
||||
peer := e.wgdev.LookupPeer(pk.Raw32())
|
||||
e.wgLock.Unlock()
|
||||
peer := dev.LookupPeer(pk.Raw32())
|
||||
if peer == nil {
|
||||
return status, false
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user