forked from kr/httpshutdown
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathReadme
More file actions
25 lines (15 loc) · 619 Bytes
/
Readme
File metadata and controls
25 lines (15 loc) · 619 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
package httpshutdown
import "github.com/kr/httpshutdown"
Package httpshutdown illustrates a possible way to do graceful shutdown
with net/http. This code is untested.
TYPES
type Server struct {
Server *http.Server
// contains filtered or unexported fields
}
Serve wraps the net/http Server and performs graceful shutdown.
func (s *Server) Serve(l net.Listener) error
Serve calls Serve on the underlying http Server, but wraps l in another
net.Listener that synchronises open connections with Wait.
func (s *Server) Wait()
Wait waits for all open connections in s to close.