diff --git a/pkg/appsrv/appsrv.go b/pkg/appsrv/appsrv.go index a9bd0afdf1..ff92549b0e 100644 --- a/pkg/appsrv/appsrv.go +++ b/pkg/appsrv/appsrv.go @@ -65,6 +65,7 @@ type Application struct { isExiting bool idleConnsClosed chan struct{} httpServer *http.Server + slaveHttpServer *http.Server } const ( @@ -490,15 +491,16 @@ func (app *Application) ListenAndServeWithoutCleanup(addr, certFile, keyFile str } func (app *Application) ListenAndServeTLSWithCleanup2(addr string, certFile, keyFile string, onStop func(), isMaster bool) { + httpSrv := app.initServer(addr) if isMaster { app.addDefaultHandlers() AddPProfHandler(app) - } - app.httpServer = app.initServer(addr) - if isMaster { + app.httpServer = httpSrv app.registerCleanShutdown(app.httpServer, onStop) + } else { + app.slaveHttpServer = httpSrv } - app.listenAndServeInternal(app.httpServer, certFile, keyFile) + app.listenAndServeInternal(httpSrv, certFile, keyFile) if isMaster { app.waitCleanShutdown() } diff --git a/pkg/cloudcommon/app/app.go b/pkg/cloudcommon/app/app.go index 44cc574b2f..3b92d6e70e 100644 --- a/pkg/cloudcommon/app/app.go +++ b/pkg/cloudcommon/app/app.go @@ -53,7 +53,7 @@ func ServeForeverExtended(app *appsrv.Application, options *common_options.BaseO if options.EnableSsl { proto = "https" } - log.Infof("Start listen on %s://%s", proto, addr) + log.Infof("Start listen on %s://%s, isMaster: %v", proto, addr, isMaster) var certfile string var sslfile string if options.EnableSsl {