Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
1049057f69 | |||
0622e00f64 | |||
c0f98d4a25 |
@ -172,8 +172,6 @@ func (m measurement) String() string {
|
||||
}
|
||||
|
||||
func (s *Server) probeUpstreamLatency() {
|
||||
if !s.once {
|
||||
s.once = true
|
||||
upstreams := s.upstreams()
|
||||
results := make([]measurement, len(upstreams))
|
||||
var wg sync.WaitGroup
|
||||
@ -201,14 +199,13 @@ func (s *Server) probeUpstreamLatency() {
|
||||
sort.Slice(results, func(i, j int) bool {
|
||||
return results[i].rtt < results[j].rtt
|
||||
})
|
||||
log.Printf("probe results: %v %v", s.once, results)
|
||||
log.Printf("probe results: %v", results)
|
||||
for idx, result := range results {
|
||||
upstreams[idx] = result.upstream
|
||||
}
|
||||
s.upstreamMu.Lock()
|
||||
defer s.upstreamMu.Unlock()
|
||||
s.upstream = upstreams
|
||||
}
|
||||
}
|
||||
|
||||
func (s *Server) hostByName(n lcHostname) (string, bool) {
|
||||
|
Reference in New Issue
Block a user