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

Support graceful shutdown #148

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

jefftt
Copy link

@jefftt jefftt commented Nov 24, 2020

This PR takes the minimal set of logic necessary to support graceful shutdown via a Shutdown() method from the std net/http server

Note: this does not implement the diameter peer disconnect

diam/server.go Outdated
@@ -137,6 +142,45 @@ func (c *conn) notifyClientGone() {
}
}

// A ConnState represents the state of a client connection to a server.
type ConnState int
Copy link
Collaborator

Choose a reason for hiding this comment

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

why not int8 here?

Copy link
Author

Choose a reason for hiding this comment

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

taken from https://github.com/golang/go/blob/master/src/net/http/server.go#L2823

looks like it can be an int8 afaict, can update

diam/server.go Outdated
}

func (c ConnState) String() string {
return stateName[c]
Copy link
Collaborator

Choose a reason for hiding this comment

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

name, ok := stateName[c]
if !ok {
return "UNDEFINED"
}
return name

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