@@ -26,7 +26,6 @@ import (
26
26
"github.com/libp2p/go-libp2p-kbucket/peerdiversity"
27
27
record "github.com/libp2p/go-libp2p-record"
28
28
recpb "github.com/libp2p/go-libp2p-record/pb"
29
- "github.com/libp2p/go-libp2p/p2p/protocol/ping"
30
29
31
30
"github.com/gogo/protobuf/proto"
32
31
ds "github.com/ipfs/go-datastore"
@@ -69,11 +68,6 @@ const (
69
68
protectedBuckets = 2
70
69
)
71
70
72
- const (
73
- // MAGIC: timeout for receiving a pong from a peer in our routing table
74
- pingTimeout = 5 * time .Second
75
- )
76
-
77
71
type addPeerRTReq struct {
78
72
p peer.ID
79
73
queryPeer bool
@@ -372,19 +366,7 @@ func makeRtRefreshManager(dht *IpfsDHT, cfg dhtcfg.Config, maxLastSuccessfulOutb
372
366
}
373
367
374
368
pingFnc := func (ctx context.Context , p peer.ID ) error {
375
- timeoutCtx , cancel := context .WithTimeout (ctx , pingTimeout )
376
- defer cancel ()
377
-
378
- // Just wait for a single ping
379
- select {
380
- case res , more := <- ping .Ping (timeoutCtx , dht .host , p ):
381
- if ! more {
382
- return timeoutCtx .Err ()
383
- }
384
- return res .Error
385
- case <- timeoutCtx .Done ():
386
- return timeoutCtx .Err ()
387
- }
369
+ return dht .protoMessenger .Ping (ctx , p )
388
370
}
389
371
390
372
r , err := rtrefresh .NewRtRefreshManager (
0 commit comments