diff --git a/pkg/router/network_stats.go b/pkg/router/network_stats.go index f7862d0d9..24150b588 100644 --- a/pkg/router/network_stats.go +++ b/pkg/router/network_stats.go @@ -58,8 +58,7 @@ func (s *networkStats) RemoteThroughput() int64 { s.bandwidthReceivedRecStart = time.Now() s.bandwidthReceivedRecStartMu.Unlock() - bandwidth := atomic.LoadUint64(&s.bandwidthReceived) - atomic.StoreUint64(&s.bandwidthReceived, 0) + bandwidth := atomic.SwapUint64(&s.bandwidthReceived, 0) throughput := float64(bandwidth) / timePassed.Seconds()