Skip to content

Commit

Permalink
Fix variable name collision
Browse files Browse the repository at this point in the history
  • Loading branch information
maddie committed Sep 16, 2020
1 parent 06859d9 commit 02de79b
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions defs/server.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,9 @@ func (s *Server) PingAndJitter(count int) (float64, float64, error) {
}

var lastPing, jitter float64
for idx, ping := range pings {
for idx, p := range pings {
if idx != 0 {
instJitter := math.Abs(lastPing - ping)
instJitter := math.Abs(lastPing - p)
if idx > 1 {
if jitter > instJitter {
jitter = jitter*0.7 + instJitter*0.3
Expand All @@ -182,7 +182,7 @@ func (s *Server) PingAndJitter(count int) (float64, float64, error) {
}
}
}
lastPing = ping
lastPing = p
}

return getAvg(pings), jitter, nil
Expand Down

0 comments on commit 02de79b

Please sign in to comment.