1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-10-25 10:27:01 +08:00

Merge pull request #1494 from ipfs/fix/dht-test-connect

mark other nodes in routing table on test-connect
This commit is contained in:
Jeromy Johnson
2015-07-19 16:42:10 -07:00

View File

@ -78,6 +78,16 @@ func connect(t *testing.T, ctx context.Context, a, b *IpfsDHT) {
if err := a.host.Connect(ctx, pi); err != nil { if err := a.host.Connect(ctx, pi); err != nil {
t.Fatal(err) t.Fatal(err)
} }
// loop until connection notification has been received.
// under high load, this may not happen as immediately as we would like.
for a.routingTable.Find(b.self) == "" {
time.Sleep(time.Millisecond * 5)
}
for b.routingTable.Find(a.self) == "" {
time.Sleep(time.Millisecond * 5)
}
} }
func bootstrap(t *testing.T, ctx context.Context, dhts []*IpfsDHT) { func bootstrap(t *testing.T, ctx context.Context, dhts []*IpfsDHT) {