Commit 8adda0ff authored by Juan Batiz-Benet's avatar Juan Batiz-Benet

dht: bootstrap query constants

parent e630ca60
...@@ -28,6 +28,10 @@ var log = eventlog.Logger("dht") ...@@ -28,6 +28,10 @@ var log = eventlog.Logger("dht")
const doPinging = false const doPinging = false
// NumBootstrapQueries defines the number of random dht queries to do to
// collect members of the routing table.
const NumBootstrapQueries = 5
// TODO. SEE https://github.com/jbenet/node-ipfs/blob/master/submodules/ipfs-dht/index.js // TODO. SEE https://github.com/jbenet/node-ipfs/blob/master/submodules/ipfs-dht/index.js
// IpfsDHT is an implementation of Kademlia with Coral and S/Kademlia modifications. // IpfsDHT is an implementation of Kademlia with Coral and S/Kademlia modifications.
...@@ -364,7 +368,7 @@ func (dht *IpfsDHT) PingRoutine(t time.Duration) { ...@@ -364,7 +368,7 @@ func (dht *IpfsDHT) PingRoutine(t time.Duration) {
func (dht *IpfsDHT) Bootstrap(ctx context.Context) { func (dht *IpfsDHT) Bootstrap(ctx context.Context) {
var wg sync.WaitGroup var wg sync.WaitGroup
for i := 0; i < 10; i++ { for i := 0; i < NumBootstrapQueries; i++ {
wg.Add(1) wg.Add(1)
go func() { go func() {
defer wg.Done() defer wg.Done()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment