add peer info after FindPeer RPC
fix ping test
Jeromy committed
Jan 9, 2015 at 22:37 UTC
50c8561bdd7f2b8449f39d0294ee857def522c7a
2 files changed
+3
-2
core/commands/ping.go
+1
@@ -110,6 +110,7 @@ send pings, wait for pongs, and print out round-trip latency information.
110
}
111
ctx, _ := context.WithTimeout(context.Background(), kPingTimeout)
112
p, err := n.Routing.FindPeer(ctx, peerID)
113
+ n.Peerstore.AddPeerInfo(p)
114
if err != nil {
115
outChan <- &PingResult{Text: "Peer lookup error!"}
116
outChan <- &PingResult{Text: err.Error()}
routing/dht/dht_test.go
+2
-2
@@ -116,12 +116,12 @@ func TestPing(t *testing.T) {
116
117
//Test that we can ping the node
118
ctxT, _ := context.WithTimeout(ctx, 100*time.Millisecond)
119
- if err := dhtA.Ping(ctxT, peerB); err != nil {
119
+ if _, err := dhtA.Ping(ctxT, peerB); err != nil {
120
t.Fatal(err)
121
}
122
123
ctxT, _ = context.WithTimeout(ctx, 100*time.Millisecond)
124
- if err := dhtB.Ping(ctxT, peerA); err != nil {
124
+ if _, err := dhtB.Ping(ctxT, peerA); err != nil {
125
t.Fatal(err)
126
}
127
}