mirror of
https://github.com/fluencelabs/go-libp2p-kad-dht
synced 2025-08-01 04:22:05 +00:00
dht bootstrap err check fix + logging
This commit is contained in:
11
dht.go
11
dht.go
@@ -372,13 +372,14 @@ func (dht *IpfsDHT) Bootstrap(ctx context.Context) {
|
||||
id := make([]byte, 16)
|
||||
rand.Read(id)
|
||||
pi, err := dht.FindPeer(ctx, peer.ID(id))
|
||||
if err != nil {
|
||||
// NOTE: this is not an error. this is expected!
|
||||
if err == routing.ErrNotFound {
|
||||
// this isn't an error. this is precisely what we expect.
|
||||
} else if err != nil {
|
||||
log.Errorf("Bootstrap peer error: %s", err)
|
||||
} else {
|
||||
// woah, we got a peer under a random id? it _cannot_ be valid.
|
||||
log.Errorf("dht seemingly found a peer at a random bootstrap id (%s)...", pi)
|
||||
}
|
||||
|
||||
// woah, we got a peer under a random id? it _cannot_ be valid.
|
||||
log.Errorf("dht seemingly found a peer at a random bootstrap id (%s)...", pi)
|
||||
}()
|
||||
}
|
||||
wg.Wait()
|
||||
|
Reference in New Issue
Block a user