-
Notifications
You must be signed in to change notification settings - Fork 81
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
Implement shutdown sequence #176
Conversation
7d59e0d
to
d906422
Compare
Codecov Report
@@ Coverage Diff @@
## master #176 +/- ##
==========================================
+ Coverage 77.35% 77.84% +0.48%
==========================================
Files 43 46 +3
Lines 2438 2609 +171
==========================================
+ Hits 1886 2031 +145
- Misses 419 440 +21
- Partials 133 138 +5
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
1e03c34
to
d3526d0
Compare
d3526d0
to
4805ca3
Compare
My apologies for not being able spare time for this. I will review this from now. I have just rebased on current master. It appears to be such an excellent work indeed! :D |
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.
This is really an amazing work! Thanks so much for being one of the very few contributors of SCTP. I have left some comments. Also, let me share my notes just in case it helps.
Thanks again!
association.go
Outdated
|
||
a.lock.Unlock() | ||
|
||
return a.closeWriteLoopCh, nil |
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.
I am a bit nervous about returning the channel (though it's read-only). May I hear your thoughts on this?
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.
I think I just wanted a way for the caller to know when the shutdown process has completed since it does not happen in an instant like Close
does.
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.
Shutdown sequence (esp. graceful one) is always a headache...
I personally feel that the Shutdown() should block on the channel by itself. If necessary, caller can always choose to call Shutdown() from a goroutine for async operation. Hmm, let me ask Sean.
@Sean-Der What is your thought on this? The Shutdown() method triggers the shutdown sequence. Should it block until the sequence is complete, or return a channel so that the caller could choose to wait on the channel...?
Pion mixes Javascript (non-blocking) and Go (blocking) styles which confuses myself sometimes...
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.
I think blocking is the way to go. You can optionally pass in a context to be notified. I am not an expert Go developer either though :)
- crypto/tls is a blocking Close
- HTTP provides two APIs Context and Blocking
- net.Conn is blocking as well.
So excited to have you both back I missed working together! I learn so much from your PRs and so fun to see Pion progress so quickly without me :)
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.
Thanks, I like the context.Context
way. I just pushed an update that modifies the sctp.Association.Shutdown
's signature to:
// Shutdown initiates the shutdown sequence. The method blocks until the
// shutdown sequence is completed and the connection is closed, or until the
// passed context is done, in which case the context's error is returned.
func (a *Association) Shutdown(ctx context.Context) error {
Does that work?
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.
So excited to have you both back I missed working together! I learn so much from your PRs and so fun to see Pion progress so quickly without me :)
Aww thanks ❤️ I miss Pion and working with you, I learned so much from the whole community and I don't think I'd have the clients I currently have if it weren't for you guys!
Thanks for the kind words and the review! No worries about the time - this is open source after all! I've lost a little bit of context, but I'll do my best to answer your questions 🙂 |
4805ca3
to
85af742
Compare
Closes #152.
85af742
to
096b349
Compare
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.
@Sean-Der thanks for your comment. @jeremija I like the use of context too, more idiomatic in Go. I can also see that when we improve the detached datachannel (#77), and introduction of Listen/Accept (#74), this Shutdown method with context will become very useful. At that point, as @jeremija pointed out, we'd consider renaming Shutdown to Close and the current Close to Abort, etc. Let me approve this.
Thanks for your review @enobufs!
Actually I think the current implementation of
According to my understanding, we don't send any chunk after Also, are we currently doing any checks for the verification tags when we receive packets? I see only assertions being done in tests, but not this:
|
Description
I finally had some time to continue the work on adding the multi server node support on
Peer Calls
. I noticed there was an issue where the other side did not notice that a SCTP association was closed from the other side.I tried to follow the steps from the
SCTP Association State Diagram
andShutdown of an Association
sections of RFC 4960.I added two new tests and all existing tests passed.
Instead of modifying the existing
Close
function I added a newShutdown
method to keep the backwards compatibility. I also thought it made sense to allow the users to pick which teardown strategy to use.Perhaps the
Close
should be modified to useAbort
?Reference issue
Fixes #152.