Skip to content

Commit 7035c59

Browse files
committed
chore: update kbucket
1 parent 8af12dd commit 7035c59

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

dht_bootstrap.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -204,15 +204,15 @@ func (dht *IpfsDHT) refreshCpls(ctx context.Context) error {
204204
trackedCpls := dht.routingTable.GetTrackedCplsForRefresh()
205205

206206
var merr error
207-
for _, tcpl := range trackedCpls {
208-
if time.Since(tcpl.LastRefreshAt) <= dht.rtRefreshInterval {
207+
for cpl, lastRefreshedAt := range trackedCpls {
208+
if time.Since(lastRefreshedAt) <= dht.rtRefreshInterval {
209209
continue
210210
}
211211

212212
// gen rand peer with the cpl
213-
randPeer, err := dht.routingTable.GenRandPeerID(tcpl.Cpl)
213+
randPeer, err := dht.routingTable.GenRandPeerID(uint(cpl))
214214
if err != nil {
215-
logger.Errorf("failed to generate peerID for cpl %d, err: %s", tcpl.Cpl, err)
215+
logger.Errorw("failed to generate peer ID", "cpl", cpl, "error", err)
216216
continue
217217
}
218218

@@ -222,10 +222,10 @@ func (dht *IpfsDHT) refreshCpls(ctx context.Context) error {
222222
return err
223223
}
224224

225-
if err := doQuery(tcpl.Cpl, randPeer.String(), walkFnc); err != nil {
225+
if err := doQuery(uint(cpl), randPeer.String(), walkFnc); err != nil {
226226
merr = multierror.Append(
227227
merr,
228-
fmt.Errorf("failed to do a random walk for cpl %d: %s", tcpl.Cpl, err),
228+
fmt.Errorf("failed to do a random walk for cpl %d: %w", cpl, err),
229229
)
230230
}
231231
}

go.mod

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ require (
1616
github.com/libp2p/go-eventbus v0.1.0
1717
github.com/libp2p/go-libp2p v0.7.4
1818
github.com/libp2p/go-libp2p-core v0.5.1
19-
github.com/libp2p/go-libp2p-kbucket v0.3.2
19+
github.com/libp2p/go-libp2p-kbucket v0.3.3
2020
github.com/libp2p/go-libp2p-peerstore v0.2.2
2121
github.com/libp2p/go-libp2p-record v0.1.2
2222
github.com/libp2p/go-libp2p-swarm v0.2.3

go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,8 +224,8 @@ github.com/libp2p/go-libp2p-discovery v0.2.0 h1:1p3YSOq7VsgaL+xVHPi8XAmtGyas6D2J
224224
github.com/libp2p/go-libp2p-discovery v0.2.0/go.mod h1:s4VGaxYMbw4+4+tsoQTqh7wfxg97AEdo4GYBt6BadWg=
225225
github.com/libp2p/go-libp2p-discovery v0.3.0 h1:+JnYBRLzZQtRq0mK3xhyjBwHytLmJXMTZkQfbw+UrGA=
226226
github.com/libp2p/go-libp2p-discovery v0.3.0/go.mod h1:o03drFnz9BVAZdzC/QUQ+NeQOu38Fu7LJGEOK2gQltw=
227-
github.com/libp2p/go-libp2p-kbucket v0.3.2 h1:OUMsOOSFDR+LeG9Suh8VfmhEpKeaaESNYueJUZPxVTE=
228-
github.com/libp2p/go-libp2p-kbucket v0.3.2/go.mod h1:dDq/QC8Rm5hceMYzuGF2+OpLj09VHy+UBvRVjavIlKQ=
227+
github.com/libp2p/go-libp2p-kbucket v0.3.3 h1:V2Zwv6QnCK6Who0iiJW2eUKwdlTYGJ2HnLViaolDOcs=
228+
github.com/libp2p/go-libp2p-kbucket v0.3.3/go.mod h1:IWFdYRBOYzaLEHnvrfzEkr+UcuveCXIoeO8QeFZSI6A=
229229
github.com/libp2p/go-libp2p-loggables v0.1.0 h1:h3w8QFfCt2UJl/0/NW4K829HX/0S4KD31PQ7m8UXXO8=
230230
github.com/libp2p/go-libp2p-loggables v0.1.0/go.mod h1:EyumB2Y6PrYjr55Q3/tiJ/o3xoDasoRYM7nOzEpoa90=
231231
github.com/libp2p/go-libp2p-mplex v0.2.0/go.mod h1:Ejl9IyjvXJ0T9iqUTE1jpYATQ9NM3g+OtR+EMMODbKo=

0 commit comments

Comments
 (0)