From 80a16ce3df349963b3d233f02b9e802871af81b2 Mon Sep 17 00:00:00 2001 From: qydysky Date: Wed, 19 Mar 2025 20:03:27 +0800 Subject: [PATCH] 1 --- config.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/config.go b/config.go index 6170e0c..99e51dc 100755 --- a/config.go +++ b/config.go @@ -122,7 +122,7 @@ func (t *Config) startServer(ctx context.Context, logger Logger, conf *http.Serv var fd uintptr = 0 if t.FdPath != "" { - f := pfile.New(t.FdPath, 0, false) + f := pfile.New(t.FdPath, 0, true) if f.IsExist() { if data, e := f.ReadAll(100, 100); errors.Is(e, io.EOF) { if tmp, e := strconv.Atoi(string(data)); e == nil { @@ -137,6 +137,11 @@ func (t *Config) startServer(ctx context.Context, logger Logger, conf *http.Serv syncWeb, err := pweb.NewSyncMapNoPanic(conf, fd, &t.routeP, matchfunc) if err == nil { logger.Info(`I:`, fmt.Sprintf("Running. Fd:%v", syncWeb.FD)) + f := pfile.New(t.FdPath, 0, true) + if f.IsExist() { + f.Delete() + } + f.Write([]byte(strconv.Itoa(int(syncWeb.FD))), false) shutdown = syncWeb.Shutdown return } else { -- 2.39.2