Compare commits

...

1 Commits

Author SHA1 Message Date
Percy Wegmann
6af1fd14e7 ipn/ipnlocal: add debug logging to initPeerAPIListener
initPeerAPIListener may be returning early unexpectedly. Add debug logging to
see what causes it to return early when it does.

Updates #14393

Signed-off-by: Percy Wegmann <percy@tailscale.com>
2025-03-26 10:50:20 -05:00

View File

@@ -5302,9 +5302,11 @@ func (b *LocalBackend) closePeerAPIListenersLocked() {
const peerAPIListenAsync = runtime.GOOS == "windows" || runtime.GOOS == "android"
func (b *LocalBackend) initPeerAPIListener() {
b.logf("[v1] initPeerAPIListener: entered")
b.mu.Lock()
defer b.mu.Unlock()
if b.shutdownCalled {
b.logf("[v1] initPeerAPIListener: shutting down")
return
}
@@ -5314,6 +5316,7 @@ func (b *LocalBackend) initPeerAPIListener() {
// ResetForClientDisconnect, or Start happens when its
// mutex was released, the netMap could be
// nil'ed out (Issue 1996). Bail out early here if so.
b.logf("[v1] initPeerAPIListener: no netmap")
return
}
@@ -5328,6 +5331,7 @@ func (b *LocalBackend) initPeerAPIListener() {
}
if allSame {
// Nothing to do.
b.logf("[v1] initPeerAPIListener: %d netmap addresses match existing listeners", addrs.Len())
return
}
}
@@ -5336,6 +5340,7 @@ func (b *LocalBackend) initPeerAPIListener() {
selfNode := b.netMap.SelfNode
if !selfNode.Valid() || b.netMap.GetAddresses().Len() == 0 {
b.logf("[v1] initPeerAPIListener: no addresses in netmap")
return
}
@@ -5369,7 +5374,7 @@ func (b *LocalBackend) initPeerAPIListener() {
ln, err = ps.listen(a.Addr(), b.prevIfState)
if err != nil {
if peerAPIListenAsync {
b.logf("possibly transient peerapi listen(%q) error, will try again on linkChange: %v", a.Addr(), err)
b.logf("[v1] possibly transient peerapi listen(%q) error, will try again on linkChange: %v", a.Addr(), err)
// Expected. But we fix it later in linkChange
// ("peerAPIListeners too low").
continue