Skip to content

Commit

Permalink
make warnings on no bootstrap peers less noisy
Browse files Browse the repository at this point in the history
We only need to warn the user if we *can't* connect to the network.

License: MIT
Signed-off-by: Steven Allen <[email protected]>
  • Loading branch information
Stebalien committed Sep 14, 2018
1 parent 2de6163 commit 2a47656
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions core/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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
}

Expand Down

0 comments on commit 2a47656

Please sign in to comment.