net/sockstats: return early if no radio period length

Signed-off-by: Will Norris <will@tailscale.com>
pull/7820/head
Will Norris 2 years ago committed by Will Norris
parent 75784e10e2
commit 22680a11ae

@ -332,6 +332,9 @@ func (rm *radioMonitor) radioHighPercent() int64 {
now := rm.now().Unix() now := rm.now().Unix()
var periodLength int64 = radioSampleSize var periodLength int64 = radioSampleSize
if t := now - rm.startTime; t < periodLength { if t := now - rm.startTime; t < periodLength {
if t <= 0 {
return 0
}
periodLength = t periodLength = t
} }
periodStart := now - periodLength // start of current reporting period periodStart := now - periodLength // start of current reporting period

Loading…
Cancel
Save