Stop attempting to close nil Listener (#4753)

This commit is contained in:
ebozduman 2017-08-04 10:44:46 -07:00 committed by Dee Koder
parent 28bc5899fd
commit 0aca2ab970

View File

@ -118,6 +118,10 @@ func (srv *Server) Start() (err error) {
// Shutdown - shuts down HTTP server.
func (srv *Server) Shutdown() error {
if srv.listener == nil {
return errors.New("server not initialized")
}
if atomic.AddUint32(&srv.inShutdown, 1) > 1 {
// shutdown in progress
return errors.New("http server already in shutdown")