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

fix(webrtc-utils): read buffer only if empty message #5439

Merged

Conversation

DougAnderson444
Copy link
Contributor

@DougAnderson444 DougAnderson444 commented Jun 3, 2024

Fixes #5438

Description

This PR adds a return of Poll::Ready(Ok(0)) when the message vector is empty or not present.

This missing return was causing the stream not to finish, then to be dropped, causing the request response protocol to fail over WebRTC.

Now that empty or non existent message vectors get returned as Ok(0) the stream can be read and request response works now over WebRTC.

Notes & open questions

I don't think there are any specific tests for request response over WebRTC, though I believe @jxs is working on a branch for them?

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

otherwise return Ok(0), so that reader of the stream know it has ended and is now empty
@DougAnderson444 DougAnderson444 marked this pull request as ready for review June 3, 2024 20:29
Copy link
Member

@jxs jxs left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for looking into this Doug! Do you need a release?

@jxs jxs added the send-it label Jun 5, 2024
@mergify mergify bot merged commit 3da7d91 into libp2p:master Jun 5, 2024
72 checks passed
@DougAnderson444
Copy link
Contributor Author

A minor release would be great, I was wondering what the release schedule is like these days?

@jxs
Copy link
Member

jxs commented Jun 5, 2024

released 0.2.1 Doug.

DougAnderson444 added a commit to PeerPiper/peerpiper that referenced this pull request Jun 14, 2024
since libp2p-webrtc-utils has now been released as per libp2p/rust-libp2p#5439
TimTinkers pushed a commit to unattended-backpack/rust-libp2p that referenced this pull request Sep 14, 2024
This PR adds a return of `Poll::Ready(Ok(0))` when the `message` vector is empty or not present.

This missing return was causing the stream not to finish, then to be dropped, causing the request response protocol to fail over WebRTC.

Now that empty or non existent message vectors get returned as `Ok(0)` the stream can be read and request response works now over WebRTC.

Pull-Request: libp2p#5439.
This pull request was closed.
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.

webRTC doesn't work with request-response
3 participants