Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return the correct number of remaining bootstrap requests. #2125

Merged
merged 2 commits into from
Jul 9, 2021

Conversation

rubdos
Copy link
Contributor

@rubdos rubdos commented Jul 9, 2021

As per the discussion on #2121

I can confirm that the bootstrap process seems to go a lot better now :-)

@izolyomi, I included you as Co-authored-by in the commit, but don't have an email address for it. Let me know if you want a change there.

@izolyomi
Copy link
Contributor

izolyomi commented Jul 9, 2021

I included you as Co-authored-by in the commit, but don't have an email address for it. Let me know if you want a change there.

Thanks for the nice gesture. 😃
Feel free to keep or remove me as co-author, just merge this PR as you see fit regarding your usual workflow.

@mxinden
Copy link
Member

mxinden commented Jul 9, 2021

Thanks @rubdos. Very much appreciated.

Would you mind including the diff below to prevent future regressions?

diff --git a/protocols/kad/src/behaviour/test.rs b/protocols/kad/src/behaviour/test.rs
index 7f73c1d8..f22b4b65 100644
--- a/protocols/kad/src/behaviour/test.rs
+++ b/protocols/kad/src/behaviour/test.rs
@@ -196,6 +196,10 @@ fn bootstrap() {
                                 }
                                 first = false;
                                 if ok.num_remaining == 0 {
+                                    assert_eq!(
+                                        swarm.behaviour_mut().queries.size(), 0,
+                                        "Expect no remaining queries when `num_remaining` is zero.",
+                                    );
                                     let mut known = HashSet::new();
                                     for b in swarm.behaviour_mut().kbuckets.iter() {
                                         for e in b.iter() {

@mxinden
Copy link
Member

mxinden commented Jul 9, 2021

And please also add an entry to the changelog:

diff --git a/protocols/kad/CHANGELOG.md b/protocols/kad/CHANGELOG.md
index db0b9f0d..18c03d53 100644
--- a/protocols/kad/CHANGELOG.md
+++ b/protocols/kad/CHANGELOG.md
@@ -13,8 +13,11 @@
 
 - Remove false `debug_assert` on `connected_peers` (see [PR 2120]).
 
+- Return correct number of remaining bootstrap requests (see [PR 2125]).
+
 [PR 2087]: https://github.com/libp2p/rust-libp2p/pull/2087
 [PR 2120]: https://github.com/libp2p/rust-libp2p/pull/2120
+[PR 2125]: https://github.com/libp2p/rust-libp2p/pull/2125
 
 # 0.30.0 [2021-04-13]

Fixes libp2p#2121

Co-authored-by: Max Inden <mail@max-inden.de>
Co-authored-by: @izolyomi
@rubdos rubdos force-pushed the remaining-num-bootstrap-fix branch from 2e6c989 to 8729fd8 Compare July 9, 2021 12:32
@rubdos
Copy link
Contributor Author

rubdos commented Jul 9, 2021

Done, amended the commit, @mxinden. Thanks for the quick replies.

Here's to contributing some more in the near future :-)

Copy link
Member

@mxinden mxinden left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here's to contributing some more in the near future :-)

🚀 always welcome. Let me know if you need any help.

@mxinden mxinden merged commit f600f7a into libp2p:master Jul 9, 2021
@rubdos rubdos deleted the remaining-num-bootstrap-fix branch July 9, 2021 13:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants