avoid concurrenct use of rand.NewSource (#10543)

This commit is contained in:
Harshavardhana
2020-09-22 15:34:27 -07:00
committed by GitHub
parent 4c54ed8748
commit 0537a21b79
3 changed files with 5 additions and 7 deletions

View File

@@ -354,12 +354,10 @@ func getHostsSlice(records []dns.SrvRecord) []string {
return hosts
}
var rng = rand.New(rand.NewSource(time.Now().UTC().UnixNano()))
// returns an online host (and corresponding port) from a slice of DNS records
func getHostFromSrv(records []dns.SrvRecord) (host string) {
hosts := getHostsSlice(records)
rng := rand.New(rand.NewSource(time.Now().UTC().UnixNano()))
var d net.Dialer
var retry int
for retry < len(hosts) {