Skip to content

kr/httpshutdown

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

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.



About

how to do graceful shutdown with net/http (maybe)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages