-
-
Notifications
You must be signed in to change notification settings - Fork 72
fix: RTCDataChannel readyState race condition and improve typings #359
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
Draft
mertushka
wants to merge
15
commits into
murat-dogan:master
Choose a base branch
from
mertushka:fix-rtcdatachannel
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+35
−26
Draft
Changes from 1 commit
Commits
Show all changes
15 commits
Select commit
Hold shift + click to select a range
13dd568
fix(polyfill)(RTCDataChannel): fix readyState race condition and impr…
mertushka 5863b40
Merge branch 'murat-dogan:master' into master
mertushka 6e22bd1
revert: unstandard closing event
mertushka 37e5283
chore: remove unnecessary checks
mertushka c62b15c
fix: close existing datachannels before closing peerconnection
mertushka 05381db
fix(polyfill): returning instead of throwing on closing/closed state
mertushka 5100ad9
fix(types): add explicit ArrayBuffer cast for sendMessageBinary calls
mertushka 0ec58d2
chore: remove unneeded closing check
mertushka ddce92f
fix: also check for closing data channels
mertushka b291be2
fix: prevent another race condition window
mertushka 2168c78
fix: dataChannel onClosed race condition
mertushka f3c71ec
fix: match the spec behaviour
mertushka dc6a887
chore: remove comment
mertushka 0081313
fix(RTCPeerConnection): implement spec-compliant abrupt data channel …
mertushka 9cbbf63
fix(RTCDataChannel): improve close event handling logic
mertushka File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
https://www.w3.org/TR/webrtc/#dom-rtcpeerconnection-close
NOTE
Do we actually need a separate method like forceCloseAbruptly for this case?
In the current PR DataChannel.close() implementation, the .readyState is set to "closing" immediately to prevent readyState race conditions, and only transitions to "closed" once the native layer confirms that the data channel has closed. However, according to the W3C WebRTC Data Channel specification, when a data channel is closed abruptly, the closing procedure is not invoked and .readyState must transition directly to "closed".
We should ensure that our implementation matches the expected behavior defined by the spec.
Uh oh!
There was an error while loading. Please reload this page.
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.
@murat-dogan I need your insights here.
Also, could you clarify why this implementation was removed in the first place?
b3000f1#diff-701dfe9764f8864403783f0e275aeac5f8f104601ac6b189f7deda2f9eaaa1f1L339-L340