From 0aca2ab9707f86be436800a437606301674e922a Mon Sep 17 00:00:00 2001 From: ebozduman Date: Fri, 4 Aug 2017 10:44:46 -0700 Subject: [PATCH] Stop attempting to close nil Listener (#4753) --- pkg/http/server.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/pkg/http/server.go b/pkg/http/server.go index 5181e1f96..ef48bf097 100644 --- a/pkg/http/server.go +++ b/pkg/http/server.go @@ -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")