Skip to content

fix(kad): Don't wait for behaviour after receiving AddProvider #3152

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

Merged
merged 10 commits into from
Nov 23, 2022

Conversation

thomaseizinger
Copy link
Contributor

Description

Previously, we would erroneously always go into the WaitingUser (now called WaitingBehaviour) state after receiving a message on an inbound stream. However, the AddProvider message does not warrant a "response" from the behaviour. Thus, any incoming AddProvider message would result in a stale substream that would eventually be dropped as soon as more than 32 inbound streams have been opened.

With this patch, we inline the message handling into the upper match block and perform the correct state transition upon each message. For AddProvider, we go back into WaitingMessage because the spec mandates that we need to be ready to receive more messages on an inbound stream.

Fixes #3048.

Notes

Links to any relevant issues

Open Questions

Change checklist

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • A changelog entry has been made in the appropriate crates

Answering these requests is encapsulated within the behaviour. The
user does not have any control over this.
@thomaseizinger
Copy link
Contributor Author

TODO: Check if this also happens for any other events.

@mxinden mxinden added this to the v0.50.0 milestone Nov 22, 2022
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.

Good catch @thomaseizinger. Thanks for debugging and fixing. Thanks @shamil-gadelshin for reporting the issue.

@mxinden
Copy link
Member

mxinden commented Nov 23, 2022

TODO: Check if this also happens for any other events.

Assuming, that you are not implying that we should hold off with merging here.

@mergify mergify bot merged commit 2a5a518 into master Nov 23, 2022
@thomaseizinger thomaseizinger deleted the 3048-no-waiting-user-after-add-provider branch February 24, 2023 14:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kademlia. New inbound substream to PeerId exceeds inbound substream limit. No older substream waiting to be reused.
2 participants