-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Conversation
Answering these requests is encapsulated within the behaviour. The user does not have any control over this.
…libp2p/rust-libp2p into 3048-no-waiting-user-after-add-provider
TODO: Check if this also happens for any other events. |
There was a problem hiding this 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.
Assuming, that you are not implying that we should hold off with merging here. |
Description
Previously, we would erroneously always go into the
WaitingUser
(now calledWaitingBehaviour
) state after receiving a message on an inbound stream. However, theAddProvider
message does not warrant a "response" from the behaviour. Thus, any incomingAddProvider
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 intoWaitingMessage
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 added tests that prove my fix is effective or that my feature works