From dc3d27f79a0d7170362773b137539023cc491a62 Mon Sep 17 00:00:00 2001 From: lwl0608 Date: Fri, 17 May 2024 11:46:18 +0800 Subject: [PATCH] fix --- library/httpserver/httpserver.go | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/library/httpserver/httpserver.go b/library/httpserver/httpserver.go index 90be0c2b..b6178d80 100644 --- a/library/httpserver/httpserver.go +++ b/library/httpserver/httpserver.go @@ -21,12 +21,9 @@ const ( ) func StartHttpServer(srv *http.Server, cfg *configcenter.DefaultConfig, ip string, port int) { - quit := make(chan os.Signal) - go func() { if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed { logger.Fatal("listen: %v", err) - quit <- syscall.SIGTERM return } @@ -36,12 +33,13 @@ func StartHttpServer(srv *http.Server, cfg *configcenter.DefaultConfig, ip strin go func() { err := registerSD(ip, port) if err != nil { - quit <- syscall.SIGTERM + logger.Fatal("registerSD: %v", err) return } setServerStatusFD(ServerStatusFDRun) }() + quit := make(chan os.Signal) signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM) <-quit logger.Info("Shutdown Server ...")