libp2p / go-libp2p-kbucket

A kbucket implementation for use as a routing table
MIT License
48 stars 35 forks source link

fix: correctly track CPLs of never refreshed buckets #71

Closed Stebalien closed 4 years ago

Stebalien commented 4 years ago

To determine how many buckets we should refresh, we:

  1. Look at the max bucket.
  2. Look at the peer with the greatest common prefix in the max bucket.
  3. Return the "last refresh" times for all buckets between 0 and min(maxPeer, 15)

BREAKING: this returns a slice of times instead of CplRefresh objects because we want to refresh all buckets between 0 and the max CPL.

Stebalien commented 4 years ago

LGTM from @aschmahmann over slack.

Stebalien commented 4 years ago

@aarshkshah1992 I'd like your thoughts on this post-merge. I'm merging now so I can cut an RC, but we may want to tweak the behavior here.

aarshkshah1992 commented 4 years ago

@Stebalien While this looks good to me for now, we should revisit/refactor this for 0.6. I've created a meta-issue to track it and will have more thoughts on how to improve it once I start working on the issue and dig deeper.

https://github.com/libp2p/go-libp2p-kad-dht/issues/556