1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-10 05:52:20 +08:00

rewrite findpeer and other dht tweaks

This commit is contained in:
Jeromy
2014-10-24 18:32:28 -07:00
parent f73d632354
commit 762faa7421
4 changed files with 63 additions and 83 deletions

View File

@ -283,7 +283,13 @@ func TestProvidesAsync(t *testing.T) {
ctxT, _ := context.WithTimeout(ctx, time.Millisecond*300)
provs := dhts[0].FindProvidersAsync(ctxT, u.Key("hello"), 5)
select {
case p := <-provs:
case p, ok := <-provs:
if !ok {
t.Fatal("Provider channel was closed...")
}
if p == nil {
t.Fatal("Got back nil provider!")
}
if !p.ID().Equal(dhts[3].self.ID()) {
t.Fatalf("got a provider, but not the right one. %s", p)
}