-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Add graceful stop (go 1.8) #854
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
Conversation
vishr
left a comment
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.
Rather than removing TLS*, you should check for e.Listener and e.TLSListener for nil and shutdown.
|
@vishr I thought of that, but didn't figure out why they're needed, I mean TLS* fields. At the same time this is a code simplification, we can check when TLS is enabled via |
|
@amenzhinsky They are required for the same reason as |
|
@vishr so we need to stop them both, is that correct? It'll look like: func (e *Echo) Close() (err error) {
if e.TLSListener != nil {
if err = e.TLSServer.Close(); err != nil {
return
}
}
if e.Listener != nil {
if err = e.Server.Close(); err != nil {
return
}
}
return
} |
|
Looks good to me. Also, you can just |
|
@vishr I've just updated this PR, please have a look. I still think that having multiple server instances is not such a good idea because we use only In this case we can listen to multiple ports TLS or plain, having only one server instance. What's your take on that? |
|
I think How do you use |
|
Okay then, I made it simple for now. |
|
@amenzhinsky This is merged with e7c89c4, somehow I lost your commit but the code is in. Thanks for your contribution. |
No description provided.