mirror of
https://github.com/pgsty/minio.git
synced 2026-03-15 17:17:01 +01:00
avoid concurrenct use of rand.NewSource (#10543)
This commit is contained in:
@@ -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) {
|
||||
|
||||
@@ -1235,10 +1235,10 @@ func getTestWebRPCResponse(resp *httptest.ResponseRecorder, data interface{}) er
|
||||
return nil
|
||||
}
|
||||
|
||||
var src = rand.NewSource(UTCNow().UnixNano())
|
||||
|
||||
// Function to generate random string for bucket/object names.
|
||||
func randString(n int) string {
|
||||
src := rand.NewSource(UTCNow().UnixNano())
|
||||
|
||||
b := make([]byte, n)
|
||||
// A rand.Int63() generates 63 random bits, enough for letterIdxMax letters!
|
||||
for i, cache, remain := n-1, src.Int63(), letterIdxMax; i >= 0; {
|
||||
|
||||
Reference in New Issue
Block a user