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

Reset outgoing stream on inbound is reset #1

Merged
merged 1 commit into from
Oct 8, 2022

Conversation

enobufs
Copy link

@enobufs enobufs commented Oct 2, 2022

Added state to Stream to reset outbound only when the state is open Relates to pion#187

Hi @jerry-tao, what do you think about this fix. (this branch is based on your fork jerry-tao/sctp:master).

Who to react to the incoming OutgoingResetRequest should be Stream layer (not at the Association layer).

Also, if the stream already sent its OutgoingResetRequest, it shouldn't send another one, meaning, we need to introduce a state in the Stream class (s.state), and send OutgoingResetRequest if the state is "open", I believe. Which prevented the vnet test case from failing.

As RFC 8831 implies, teardown sequence of a stream starts with outgoing (closing), then incoming (closed). This branch also addresses it by not to cause error (s.readErr) because it will eventually be reset by the remote.

I am hoping to merge this into your branch, then we can finalize it in your pull-request.

Added state to Stream to reset outbound only when the state is open
Relates to #187
},
c,
})

Copy link
Author

Choose a reason for hiding this comment

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

Here, I am simply reverting the change.

@@ -2014,6 +2014,9 @@ func (a *Association) resetStreamsIfAny(p *paramOutgoingResetRequest) *packet {
if !ok {
continue
}
a.lock.Unlock()
s.onInboundStreamReset()
a.lock.Lock()
Copy link
Author

Choose a reason for hiding this comment

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

Reporting the event to the corresponding stream and let it decide what to do.

}
s.lock.Unlock()
default:
}
Copy link
Author

Choose a reason for hiding this comment

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

This state checks are done inside sendPayloadData()

if err != nil {
return 0, err
return n, errStreamClosed
Copy link
Author

Choose a reason for hiding this comment

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

Try to use the same error object to be compatible.


if s.readErr == nil {
s.readErr = io.EOF
Copy link
Author

Choose a reason for hiding this comment

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

This is not what RFC 8831 implies. s.Close() should only close the outgoing stream. (fixing the existing bug)

if resetOutbound {
s.association.sendResetRequest(sid)
}
}
Copy link
Author

Choose a reason for hiding this comment

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

Finally, this is what we wanted in the PR.

@jerry-tao jerry-tao merged commit 03f5520 into jerry-tao:master Oct 8, 2022
@jerry-tao
Copy link
Owner

@enobufs Sorry for the delay, just come back form vacation.

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.

2 participants