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

Handle Close() correctly to cause EOF on remote #44

Merged
merged 2 commits into from
May 7, 2019
Merged

Conversation

enobufs
Copy link
Member

@enobufs enobufs commented May 3, 2019

Description

This fixes the follow (related) problems:
(1) Bug with a comparison between senderLastTSN and peerLastTSN.
(2) for loop inside stream.ReadSCTP() has a multiple of lock/unlock phases, which is causing s.readErr was evaluated before checking reassembly queue when it acquires a lock again. Consequently, io.EOF was returned when there's a data in the reassembly queue.
(3) Related to (2), the condition variable was not associated with the mutex. Probably this is why multiple of lock/unlock were needed. (at least, read from the queue and evaluate error when no data, has to be atomic!)
(4) When sender side closes a stream and sends a reset, if there’s a DATA chunk in the pending queue (TSN not assigned yet), the data will be lost.
(5) There is only one instance of paramOutgoingResetRequest and chunkReconfig at a time. Therefore, it would not work if there are multiple streams and they are resetting at the same time (with different TSN).

Please see pion/webrtc#652 for more details

Reference issue

Fixes pion/webrtc#652

Copy link

@albrow albrow left a comment

Choose a reason for hiding this comment

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

This LGTM but I would wait for @backkem too since he has more context.

@backkem backkem merged commit 4d06e0e into master May 7, 2019
@backkem backkem deleted the fix-eof-on-read branch May 7, 2019 11:54
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.

EOF returns earlier than the last message on receipt of Reset
3 participants