You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I was looking into #5626 and noticed that all iterators require exclusive (mutable) access to the whole KBucketsTable, moreover, its buckets are being modified during iteration over k-buckets, which is extremely confusing and feels like a completely arbitrary place to do this:
I did a quick look around, but wasn't able to easily fix this. Someone with better knowledge of the codebase should look into it. It is very hard to maintain the project when code so convoluted.
The text was updated successfully, but these errors were encountered:
I just had a look at the code, and I also find it very convoluted. It can definitely be simplified, but it will take a non negligible amount of refactor.
## Description
Fixes#5626
## Notes & open questions
This is the nicest way I came up with, I decided to leave
`get_closest_local_peers` as is since it does return all peers, not just
`replication_factor` peers.
Looking at #2436 it is not
clear if @folex really needed all peers returned or it just happened
that way. I'm also happy to change proposed API to return all peers if
that is preferred by others.
It is very unfortunate that `&mut self` is needed for this, I created
#5644 that if resolved will
allow to have `&self` instead.
## Change checklist
- [x] I have performed a self-review of my own code
- [x] I have made corresponding changes to the documentation
- [ ] I have added tests that prove my fix is effective or that my
feature works
- [x] A changelog entry has been made in the appropriate crates
Co-authored-by: João Oliveira <[email protected]>
I was looking into #5626 and noticed that all iterators require exclusive (mutable) access to the whole
KBucketsTable
, moreover, its buckets are being modified during iteration over k-buckets, which is extremely confusing and feels like a completely arbitrary place to do this:rust-libp2p/protocols/kad/src/kbucket.rs
Lines 463 to 501 in 417968e
Specifically this part:
rust-libp2p/protocols/kad/src/kbucket.rs
Lines 482 to 485 in 417968e
I did a quick look around, but wasn't able to easily fix this. Someone with better knowledge of the codebase should look into it. It is very hard to maintain the project when code so convoluted.
The text was updated successfully, but these errors were encountered: