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

[RSDK-5820] WebRTC connection improvement #95

Merged
merged 2 commits into from
Feb 22, 2024

Conversation

npmenard
Copy link
Member

@npmenard npmenard commented Feb 6, 2024

This PR make WebRTC connection failure faster when signaling goes wrong instead of waiting for a timeout on is_open. I have also removed AtomicPollableInterrupt and replace it with tokio::sync::* I think these primitive are a bit more flexible and allow for more cooperation between spawned Future.
Note that it won't attempt to connect again when the connection fails

@npmenard npmenard requested a review from a team as a code owner February 6, 2024 21:23
@npmenard npmenard requested review from stuqdog and benjirewis and removed request for a team February 6, 2024 21:23
Copy link
Member

@benjirewis benjirewis left a comment

Choose a reason for hiding this comment

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

Generally seems good to me, but @stuqdog will have more context. Just a question.

// Using an mpsc channel to report unrecoverable errors during Signaling, so we
// don't have to wait until the timeout expires before giving up on this attempt.
// The size of the channel is set to 1 since any error (or success) should terminate the function
let (is_open_s, mut is_open_r) = mpsc::channel(1);
Copy link
Member

Choose a reason for hiding this comment

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

If it's an mpsc channel with buffer size 1, why not use an oneshot channel?

Copy link
Member Author

Choose a reason for hiding this comment

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

oneshot channels cannot be cloned or reused multiple time (send() takes ownership) We could work around it with Arc and interior mutability but it is a bit less elegant IMO

Copy link
Member

@stuqdog stuqdog 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 doing this, definitely an improvement

@npmenard npmenard merged commit aab08d5 into viamrobotics:main Feb 22, 2024
4 checks passed
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