Stop attempting to close nil Listener (#4753)

master
ebozduman 7 years ago committed by Dee Koder
parent 28bc5899fd
commit 0aca2ab970
  1. 4
      pkg/http/server.go

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

Loading…
Cancel
Save