removed rng

This commit is contained in:
Adin Schmahmann 2020-03-26 17:56:27 -04:00
parent 84555eb240
commit 7bf2357908
2 changed files with 0 additions and 10 deletions

4
dht.go
View File

@ -5,7 +5,6 @@ import (
"context"
"errors"
"fmt"
"math/rand"
"sync"
"time"
@ -65,8 +64,6 @@ type IpfsDHT struct {
providers *providers.ProviderManager
birth time.Time // When this peer started up
rng *rand.Rand // Source of randomness
rnglk sync.Mutex // Rand does not support concurrency
Validator record.Validator
@ -222,7 +219,6 @@ func makeDHT(ctx context.Context, h host.Host, cfg config) (*IpfsDHT, error) {
host: h,
strmap: make(map[peer.ID]*messageSender),
birth: time.Now(),
rng: rand.New(rand.NewSource(rand.Int63())),
protocols: protocols,
serverProtocols: serverProtocols,
bucketSize: cfg.bucketSize,

View File

@ -136,12 +136,6 @@ func (dht *IpfsDHT) runQuery(ctx context.Context, target string, queryFn queryFn
return nil, kb.ErrLookupFailure
}
dht.rnglk.Lock()
dht.rng.Shuffle(len(seedPeers), func(i, j int) {
seedPeers[i], seedPeers[j] = seedPeers[j], seedPeers[i]
})
dht.rnglk.Unlock()
q := &query{
ctx: queryCtx,
cancel: cancelQuery,