提交 50c8561b 作者: Jeromy

add peer info after FindPeer RPC

fix ping test
上级 566a86f5
......@@ -110,6 +110,7 @@ send pings, wait for pongs, and print out round-trip latency information.
}
ctx, _ := context.WithTimeout(context.Background(), kPingTimeout)
p, err := n.Routing.FindPeer(ctx, peerID)
n.Peerstore.AddPeerInfo(p)
if err != nil {
outChan <- &PingResult{Text: "Peer lookup error!"}
outChan <- &PingResult{Text: err.Error()}
......
......@@ -116,12 +116,12 @@ func TestPing(t *testing.T) {
//Test that we can ping the node
ctxT, _ := context.WithTimeout(ctx, 100*time.Millisecond)
if err := dhtA.Ping(ctxT, peerB); err != nil {
if _, err := dhtA.Ping(ctxT, peerB); err != nil {
t.Fatal(err)
}
ctxT, _ = context.WithTimeout(ctx, 100*time.Millisecond)
if err := dhtB.Ping(ctxT, peerA); err != nil {
if _, err := dhtB.Ping(ctxT, peerA); err != nil {
t.Fatal(err)
}
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论