@cryptotaxi247 / kubo / commits / fbba7c8f3

bootstrap: only dht bootstrap with live conns

Juan Batiz-Benet committed Jan 6, 2015 at 10:10 UTC fbba7c8f397e93ea6d88bbf79aa3b85bc86f4d92
1 file changed +6 -4
core/bootstrap.go
+6 -4
@@ -96,10 +96,12 @@ func bootstrap(ctx context.Context,
96 }
97
98 // we can try running dht bootstrap even if we're connected to all bootstrap peers.
99 - if err := r.Bootstrap(ctx, numDHTBootstrapQueries); err != nil {
100 - // log this as Info. later on, discern better between errors.
101 - log.Infof("dht bootstrap err: %s", err)
102 - return nil
99 + if len(h.Network().Conns()) > 0 {
100 + if err := r.Bootstrap(ctx, numDHTBootstrapQueries); err != nil {
101 + // log this as Info. later on, discern better between errors.
102 + log.Infof("dht bootstrap err: %s", err)
103 + return nil
104 + }
105 }
106 return nil
107 }