Commit 76f388b6 authored by Steven Allen's avatar Steven Allen

chore(bootstrap): reduce indent level

parent 4eaf4293
...@@ -102,22 +102,23 @@ func (dht *IpfsDHT) refreshBuckets(ctx context.Context) { ...@@ -102,22 +102,23 @@ func (dht *IpfsDHT) refreshBuckets(ctx context.Context) {
buckets = buckets[:16] buckets = buckets[:16]
} }
for bucketID, bucket := range buckets { for bucketID, bucket := range buckets {
if time.Since(bucket.RefreshedAt()) > dht.rtRefreshPeriod { if time.Since(bucket.RefreshedAt()) <= dht.rtRefreshPeriod {
// gen rand peer in the bucket continue
randPeerInBucket := dht.routingTable.GenRandPeerID(bucketID) }
// gen rand peer in the bucket
// walk to the generated peer randPeerInBucket := dht.routingTable.GenRandPeerID(bucketID)
walkFnc := func(c context.Context) error {
_, err := dht.FindPeer(c, randPeerInBucket) // walk to the generated peer
if err == routing.ErrNotFound { walkFnc := func(c context.Context) error {
return nil _, err := dht.FindPeer(c, randPeerInBucket)
} if err == routing.ErrNotFound {
return err return nil
} }
return err
}
if err := doQuery(bucketID, randPeerInBucket.String(), walkFnc); err != nil { if err := doQuery(bucketID, randPeerInBucket.String(), walkFnc); err != nil {
logger.Warningf("failed to do a random walk on bucket %d", bucketID) logger.Warningf("failed to do a random walk on bucket %d", bucketID)
}
} }
} }
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment