-
Notifications
You must be signed in to change notification settings - Fork 79
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
Remove the pending buffer after the data channel call close() by either side. #239
Comments
But |
@enobufs You are right, I made a mistake in my test code. So the only change should be:
|
I found myself still debating whether the pending data should be discarded when OutgoingResetRequest was already received. Remote sent OutgoingResetRequest ("I am not going to send any more") but not IncomingResetRequest ("please stop sending any more"). I can see RFC8831/6252 had a graceful shutdown (e.g. shutdown(SHUT_WR)) in mind when they were written.
Interoperability with browsers is important but Pion does not need to follow everything what W3C spec says. Pion could take advantage of being a native library... |
Yes, I agree with you that OutgoingReset should only mean shutdown() rather than close. |
Here are my thoughts,
So my understanding is "clear data channel's buffer when data channel is closed remotely since no one will receive the data". |
Let us consider implementing stream.CloseWrite() in the future if a graceful shutdown is desired. Does this diagram make sense to you? stateDiagram-v2
Open --> Closing: onInboundStreamReset() called\nSet readErr to io.EOF
Open --> Closed: Close() called\nSet readErr to io.EOF\nSend all pending user data\nSend OutgoingStreamResetRequest
Closing --> Closed: Close() called\nSend OutgoingStreamResetRequest\nDiscard pending user data
|
How about moving cache and close logic to datachannel? |
Hi Jerry, Sorry for my late response. I was too busy over the last week... Good call. I was thinking about the option "B" too. This buffering is for WebRTC API and I believe it does not even belong to SCTP stream. (Relates to #77) We'd need to carefully think about potential risk / drawbacks also. What is your preference? One little favor to ask you.. Could you please create two PRs (the options A and B), mark it as One way to think about this is, if we agree that this buffering is WebRTC specific, we should move this buffer to datachannel (DCEP) package, likely in pion/sctp v2., and focus on "A" for now. |
Thanks for sharing your opinion. Let's focus on the plan A. |
Relates to pion#239
Relates to pion#239
@enobufs Just wondering: could it be that this PR (commit c0159aa) introduced a regression which makes the unit-test See https://github.com/pion/sctp/actions/runs/3495811764/jobs/5852996166 |
Summary
Remove the pending buffer after the channel is closed by either side.
Motivation
Please refer to #238
Describe alternatives you've considered
In the official WebRTC code, all pending data will be clear after the data channel call close() by either side.
But the SCTP RFC does not suggest so. The chrome will ACK the closing channel data too.
Based on @enobufs 's work, here is my thought:
Or we could emit the closing state to the caller ( data channel) to decide what to do.
Additional context
During reading the official webrtc code, I found it has more assumptions like:
References
The text was updated successfully, but these errors were encountered: