net/routecheck: tweak routecheck documentation and coding style
This patch is a follow-up for PR #19639 that does some cleanups. Updates #17366 Updates tailscale/corp#33033 Signed-off-by: Simon Law <sfllaw@tailscale.com>
This commit is contained in:
@@ -137,8 +137,13 @@ func (c *Client) probe(ctx context.Context, nodes iter.Seq[probed], limit int, t
|
||||
metricPingError.Add(1)
|
||||
return nil
|
||||
default:
|
||||
c.vlogf("ping %s (%s): result: %f ms (err: %v)",
|
||||
n.addr, n.ID(), pong.LatencySeconds*1000, pong.Err)
|
||||
if pong.Err != "" {
|
||||
c.vlogf("ping %s (%s): result: %f ms (err: %v)",
|
||||
n.addr, n.ID(), pong.LatencySeconds*1000, pong.Err)
|
||||
} else {
|
||||
c.vlogf("ping %s (%s): result: %f ms",
|
||||
n.addr, n.ID(), pong.LatencySeconds*1000)
|
||||
}
|
||||
metricPingReachable.Add(1)
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ var (
|
||||
)
|
||||
|
||||
// Report returns the latest reachability report.
|
||||
// Returns nil if a report isn’t available, which happens during initialization.
|
||||
// It returns nil if a report isn’t available, which happens during initialization.
|
||||
func (c *Client) Report() *Report {
|
||||
metricReport.Add(1)
|
||||
nm := c.nm.NetMapNoPeers()
|
||||
|
||||
@@ -195,9 +195,9 @@ func (c *Client) Close() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
ch := c.hasNetMap.Swap(nil) // clear before waking anything up
|
||||
if ch != nil && *ch != nil {
|
||||
close(*ch)
|
||||
hasNetMap := c.hasNetMap.Swap(nil) // clear before waking anything up
|
||||
if hasNetMap != nil && *hasNetMap != nil {
|
||||
close(*hasNetMap) // wake waitForNetMap
|
||||
}
|
||||
|
||||
return nil
|
||||
|
||||
Reference in New Issue
Block a user