-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: Server Discovery and Monitoring
-
None
-
Fully Compatible
There's code in updateAverageRTT that computes a trailing RTT average. However, that code is gated on averageRTTSet, and that's never set to true.
func (s *Server) updateAverageRTT(delay time.Duration) time.Duration { if !s.averageRTTSet { s.averageRTT = delay } else { alpha := 0.2 s.averageRTT = time.Duration(alpha*float64(delay) + (1-alpha)*float64(s.averageRTT)) } return s.averageRTT }
That should probably be:
func (s *Server) updateAverageRTT(delay time.Duration) time.Duration { if !s.averageRTTSet { s.averageRTT = delay s.averageRTTSet = true } else { alpha := 0.2 s.averageRTT = time.Duration(alpha*float64(delay) + (1-alpha)*float64(s.averageRTT)) } return s.averageRTT }