Skip to content

Commit

Permalink
Revert "use ping protocol instead of DHT ping"
Browse files Browse the repository at this point in the history
This reverts commit 16823c3.
  • Loading branch information
dennis-tra committed Feb 7, 2023
1 parent d5ea78f commit 397805c
Showing 1 changed file with 1 addition and 14 deletions.
15 changes: 1 addition & 14 deletions dht.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import (
"github.com/libp2p/go-libp2p-kbucket/peerdiversity"
record "github.com/libp2p/go-libp2p-record"
recpb "github.com/libp2p/go-libp2p-record/pb"
"github.com/libp2p/go-libp2p/p2p/protocol/ping"

"github.com/gogo/protobuf/proto"
ds "github.com/ipfs/go-datastore"
Expand Down Expand Up @@ -372,19 +371,7 @@ func makeRtRefreshManager(dht *IpfsDHT, cfg dhtcfg.Config, maxLastSuccessfulOutb
}

pingFnc := func(ctx context.Context, p peer.ID) error {
timeoutCtx, cancel := context.WithTimeout(ctx, pingTimeout)
defer cancel()

// Just wait for a single ping
select {
case res, more := <-ping.Ping(timeoutCtx, dht.host, p):
if !more {
return timeoutCtx.Err()
}
return res.Error
case <-timeoutCtx.Done():
return timeoutCtx.Err()
}
return dht.protoMessenger.Ping(ctx, p)
}

r, err := rtrefresh.NewRtRefreshManager(
Expand Down

0 comments on commit 397805c

Please sign in to comment.