提交 8adda0ff 作者: Juan Batiz-Benet

dht: bootstrap query constants

上级 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 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论