Skip to content

Commit

Permalink
Tidy up a few other things
Browse files Browse the repository at this point in the history
  • Loading branch information
anacrolix committed Jan 23, 2019
1 parent ab91b59 commit 402fdfd
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions dht_bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,14 +49,6 @@ func (dht *IpfsDHT) BootstrapWithConfig(ctx context.Context, cfg BootstrapConfig
if cfg.Queries <= 0 {
return fmt.Errorf("invalid number of queries: %d", cfg.Queries)
}
ctx, cancel := context.WithCancel(ctx)
go func() {
defer cancel()
select {
case <-dht.Context().Done():
case <-ctx.Done():
}
}()
go func() {
for {
err := dht.runBootstrap(ctx, cfg)
Expand Down Expand Up @@ -96,8 +88,9 @@ func (dht *IpfsDHT) randomWalk(ctx context.Context) error {
case routing.ErrNotFound:
return nil
case nil:
// We found a peer from a randomly generated ID. This should be very unlikely.
log.Warningf("Bootstrap peer error: Actually FOUND peer. (%s, %s)", id, p)
// We found a peer from a randomly generated ID. This should be very
// unlikely.
log.Warningf("random walk toward %s actually found peer: %s", id, p)
return nil
default:
return err
Expand All @@ -106,7 +99,6 @@ func (dht *IpfsDHT) randomWalk(ctx context.Context) error {

// runBootstrap builds up list of peers by requesting random peer IDs
func (dht *IpfsDHT) runBootstrap(ctx context.Context, cfg BootstrapConfig) error {

bslog := func(msg string) {
log.Debugf("DHT %s dhtRunBootstrap %s -- routing table size: %d", dht.self, msg, dht.routingTable.Size())
}
Expand Down

0 comments on commit 402fdfd

Please # to comment.