From 2a476567c6d9a6500a120c510660d15a089d994a Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Thu, 13 Sep 2018 22:46:14 -0700 Subject: [PATCH] make warnings on no bootstrap peers less noisy We only need to warn the user if we *can't* connect to the network. License: MIT Signed-off-by: Steven Allen --- core/bootstrap.go | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/core/bootstrap.go b/core/bootstrap.go index f7551058393..9c7f9057b19 100644 --- a/core/bootstrap.go +++ b/core/bootstrap.go @@ -117,9 +117,6 @@ func bootstrapRound(ctx context.Context, host host.Host, cfg BootstrapConfig) er // get bootstrap peers from config. retrieving them here makes // sure we remain observant of changes to client configuration. peers := cfg.BootstrapPeers() - if len(peers) == 0 { - log.Error("no bootstrap nodes configured: go-ipfs may have difficulty connecting to the network") - } // determine how many bootstrap connections to open connected := host.Network().Peers() if len(connected) >= cfg.MinPeerThreshold { @@ -141,6 +138,11 @@ func bootstrapRound(ctx context.Context, host host.Host, cfg BootstrapConfig) er // if connected to all bootstrap peer candidates, exit if len(notConnected) < 1 { log.Debugf("%s no more bootstrap peers to create %d connections", id, numToDial) + if len(peers) == 0 { + // We're *need* to bootstrap but we have no bootstrap + // peers configured *at all*, inform the user. + log.Error("no bootstrap nodes configured: go-ipfs may have difficulty connecting to the network") + } return ErrNotEnoughBootstrapPeers }