Skip to content

Commit 22680a1

Browse files
committed
net/sockstats: return early if no radio period length
Signed-off-by: Will Norris <will@tailscale.com>
1 parent 75784e1 commit 22680a1

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

net/sockstats/sockstats_tsgo.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -332,6 +332,9 @@ func (rm *radioMonitor) radioHighPercent() int64 {
332332
now := rm.now().Unix()
333333
var periodLength int64 = radioSampleSize
334334
if t := now - rm.startTime; t < periodLength {
335+
if t <= 0 {
336+
return 0
337+
}
335338
periodLength = t
336339
}
337340
periodStart := now - periodLength // start of current reporting period

0 commit comments

Comments
 (0)