提交 b5cbc8b6 作者: Juan Batiz-Benet

dht_test: better bootstrapping logging

上级 900c1fbf
......@@ -94,17 +94,19 @@ func connect(t *testing.T, ctx context.Context, a, b *IpfsDHT) {
func bootstrap(t *testing.T, ctx context.Context, dhts []*IpfsDHT) {
// try multiple rounds...
rounds := 5
rounds := 1
for i := 0; i < rounds; i++ {
fmt.Printf("bootstrapping round %d/%d\n", i, rounds)
var wg sync.WaitGroup
for _, dht := range dhts {
wg.Add(1)
go func() {
go func(i int) {
defer wg.Done()
<-time.After(time.Duration(i) * time.Millisecond) // stagger them to avoid overwhelming
fmt.Printf("bootstrapping round %d/%d -- %s\n", i, rounds, dht.self)
dht.Bootstrap(ctx)
}()
}(i)
}
wg.Wait()
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论