all: remove some Debug fields, NetworkMap.Debug, Reconfig Debug arg

Updates #8923

Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2023-08-17 17:29:15 -07:00
committed by Brad Fitzpatrick
parent 86ad1ea60e
commit af2e4909b6
12 changed files with 27 additions and 184 deletions

View File

@@ -13,7 +13,6 @@ import (
"io"
"net"
"net/netip"
"reflect"
"runtime"
"slices"
"strconv"
@@ -1756,17 +1755,12 @@ func (c *Conn) SetNetworkMap(nm *netmap.NetworkMap) {
}
priorNetmap := c.netMap
var priorDebug *tailcfg.Debug
if priorNetmap != nil {
priorDebug = priorNetmap.Debug
}
debugChanged := !reflect.DeepEqual(priorDebug, nm.Debug)
metricNumPeers.Set(int64(len(nm.Peers)))
// Update c.netMap regardless, before the following early return.
c.netMap = nm
if priorNetmap != nil && nodesEqual(priorNetmap.Peers, nm.Peers) && !debugChanged {
if priorNetmap != nil && nodesEqual(priorNetmap.Peers, nm.Peers) {
// The rest of this function is all adjusting state for peers that have
// changed. But if the set of peers is equal and the debug flags (for
// silent disco) haven't changed, no need to do anything else.