syncs: delete Map.Range, update callers to iterators

Updates #11038

Change-Id: I2819fed896cc4035aba5e4e141b52c12637373b1
Signed-off-by: Brad Fitzpatrick <bradfitz@tailscale.com>
This commit is contained in:
Brad Fitzpatrick
2024-10-09 13:48:18 -07:00
committed by Brad Fitzpatrick
parent 2cadb80fb2
commit c763b7a7db
5 changed files with 11 additions and 32 deletions

View File

@ -414,15 +414,14 @@ func init() {
// endpoint, and name collisions will result in Prometheus scraping errors.
clientmetric.NewCounterFunc("netstack_tcp_forward_dropped_attempts", func() int64 {
var total uint64
stacksForMetrics.Range(func(ns *Impl, _ struct{}) bool {
for ns := range stacksForMetrics.Keys() {
delta := ns.ipstack.Stats().TCP.ForwardMaxInFlightDrop.Value()
if total+delta > math.MaxInt64 {
total = math.MaxInt64
return false
break
}
total += delta
return true
})
}
return int64(total)
})
}