As pointed out by raul, bootstrapping and refreshing are not the same thing.
Bootstrapping is the initial setup (i.e., connect to some initial nodes to get
started). Refreshing is the process of refreshing the routing table.
1) on connecting to a new peer -> trigger self & bucket bootstrap if RT size goes below thereshold
2) accept formatting & doc suggestions in the review
3) remove RT recovery code for now -> will address in a separate PR once #383 goes in
changes as per review
2) seed RT if empty before starting bootstrap incase 1 hasn't fired
3) pass bootstrap config as option while creating Dht
4) replace all bootstrap function with 1 function
We usually _explicitly_ call connect before calling `prep` but we may disconnect
somewhere in-between. We _don't_ want to get stuck here dialing if the context
has been canceled.
* Rework TestFindPeersQuery
Unravel the logic and create a minimal test case that isn't flaky.
* Use testing.T.Logf
* Skip the original test in short mode
* Add comments for the arguments to testFindPeerQuery
* Qualify aberrant package name
* Use redundant package names
* gx import testify 1.3.0.
* Remove signal bootstrapping
Remove IpfsDHT.BootstrapOnSignal.
* Type check expected interfaces on IpfsDHT
* Simplify the bootstrap logic
* Tidy up a few other things
* Include BootstrapOnce
* Add comment about duplicating sanity checks
* Use existing import naming convention
* Defer error wrapping until we need it
* Restore existing query count behaviour
Note: this does mean that the DHT won't work with peer keys by default and that
the constructor signature changes. Given all the changes that'll come with the
libp2p refactor, I don't feel too bad about this.
1. We need to close the process to tear it down.
2. Closing the signal channel will cause the goprocess timer to fire repeatedly so let's not do that.
3. Don't leak a goroutine (the amplify one).