From fbba7c8f397e93ea6d88bbf79aa3b85bc86f4d92 Mon Sep 17 00:00:00 2001 From: Juan Batiz-Benet Date: Tue, 6 Jan 2015 10:10:20 -0800 Subject: [PATCH] bootstrap: only dht bootstrap with live conns --- core/bootstrap.go | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/core/bootstrap.go b/core/bootstrap.go index 342902f41..8f11596ca 100644 --- a/core/bootstrap.go +++ b/core/bootstrap.go @@ -96,10 +96,12 @@ func bootstrap(ctx context.Context, } // we can try running dht bootstrap even if we're connected to all bootstrap peers. - if err := r.Bootstrap(ctx, numDHTBootstrapQueries); err != nil { - // log this as Info. later on, discern better between errors. - log.Infof("dht bootstrap err: %s", err) - return nil + if len(h.Network().Conns()) > 0 { + if err := r.Bootstrap(ctx, numDHTBootstrapQueries); err != nil { + // log this as Info. later on, discern better between errors. + log.Infof("dht bootstrap err: %s", err) + return nil + } } return nil }