fix
This commit is contained in:
parent
d76bf6a811
commit
dc3d27f79a
|
@ -21,12 +21,9 @@ const (
|
||||||
)
|
)
|
||||||
|
|
||||||
func StartHttpServer(srv *http.Server, cfg *configcenter.DefaultConfig, ip string, port int) {
|
func StartHttpServer(srv *http.Server, cfg *configcenter.DefaultConfig, ip string, port int) {
|
||||||
quit := make(chan os.Signal)
|
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {
|
if err := srv.ListenAndServe(); err != nil && err != http.ErrServerClosed {
|
||||||
logger.Fatal("listen: %v", err)
|
logger.Fatal("listen: %v", err)
|
||||||
quit <- syscall.SIGTERM
|
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,12 +33,13 @@ func StartHttpServer(srv *http.Server, cfg *configcenter.DefaultConfig, ip strin
|
||||||
go func() {
|
go func() {
|
||||||
err := registerSD(ip, port)
|
err := registerSD(ip, port)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
quit <- syscall.SIGTERM
|
logger.Fatal("registerSD: %v", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
setServerStatusFD(ServerStatusFDRun)
|
setServerStatusFD(ServerStatusFDRun)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
|
quit := make(chan os.Signal)
|
||||||
signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)
|
signal.Notify(quit, syscall.SIGINT, syscall.SIGTERM)
|
||||||
<-quit
|
<-quit
|
||||||
logger.Info("Shutdown Server ...")
|
logger.Info("Shutdown Server ...")
|
||||||
|
|
Loading…
Reference in New Issue