ipn/ipnlocal: add back a watchdog after earlier removal from engine
Commit 2b338dd6a8 removed watchdogEngine because it was weird
(so many methods) and increasingly unnecessary after we'd cleaned up
and simplified so much of the locking.
This adds back a watchdog, but an easier to maintain one that's more
idiomatic.
Updates #19759
Change-Id: I86c458473e126c0809f37696446ce7acf4cc4eb9
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
committed by
Brad Fitzpatrick
parent
a846665599
commit
52400dc6f4
@@ -1541,6 +1541,17 @@ func (e *userspaceEngine) PeerForIP(ip netip.Addr) (ret PeerForIP, ok bool) {
|
||||
e.mu.Lock()
|
||||
nm := e.netMap
|
||||
e.mu.Unlock()
|
||||
|
||||
if !ip.IsValid() {
|
||||
// Treat invalid IPs as just a mutex probe to detect deadlocks.
|
||||
// TODO(bradfitz): extend the Engine interface to have an explicit method for
|
||||
// this purpose, instead of overloading PeerForIP with this special case.
|
||||
// But I'd rather do that at the beginning of a dev cycle.
|
||||
e.wgLock.Lock()
|
||||
defer e.wgLock.Unlock()
|
||||
return ret, false
|
||||
}
|
||||
|
||||
if nm == nil {
|
||||
return ret, false
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user