Skip to content

Commit

Permalink
Merge pull request #689 from Darkren/fix/bandwidth-calculation
Browse files Browse the repository at this point in the history
Fix remote throughput calculation
  • Loading branch information
jdknives authored Feb 23, 2021
2 parents eeda06d + 8159802 commit 36456f8
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions pkg/router/network_stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit 36456f8

Please sign in to comment.