mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-16 11:41:39 +00:00
ipn/ipnlocal: avoid unneeded initPeerAPIListener work if no changes
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
parent
20e7646b8d
commit
fe23506471
@ -1600,6 +1600,20 @@ func (b *LocalBackend) initPeerAPIListener() {
|
|||||||
b.mu.Lock()
|
b.mu.Lock()
|
||||||
defer b.mu.Unlock()
|
defer b.mu.Unlock()
|
||||||
|
|
||||||
|
if len(b.netMap.Addresses) == len(b.peerAPIListeners) {
|
||||||
|
allSame := true
|
||||||
|
for i, pln := range b.peerAPIListeners {
|
||||||
|
if pln.ip != b.netMap.Addresses[i].IP {
|
||||||
|
allSame = false
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if allSame {
|
||||||
|
// Nothing to do.
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
b.peerAPIServer = nil
|
b.peerAPIServer = nil
|
||||||
for _, pln := range b.peerAPIListeners {
|
for _, pln := range b.peerAPIListeners {
|
||||||
pln.Close()
|
pln.Close()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user