From 41b7cf8eb92f6bd4af5d2a6bd8f6e94bad6c2f6f Mon Sep 17 00:00:00 2001 From: wyx2685 Date: Fri, 24 Nov 2023 18:16:44 +0900 Subject: [PATCH] =?UTF-8?q?=E5=B0=9D=E8=AF=95=E4=BF=AE=E5=A4=8D=E8=87=AA?= =?UTF-8?q?=E5=8A=A8=E9=87=8D=E8=BD=BD=E9=85=8D=E7=BD=AE=E4=B8=8D=E6=88=90?= =?UTF-8?q?=E5=8A=9F=E7=9A=84BUG?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- cmd/server.go | 11 ++++++----- node/controller.go | 4 ++++ 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/cmd/server.go b/cmd/server.go index b2e074e..310d86f 100644 --- a/cmd/server.go +++ b/cmd/server.go @@ -1,6 +1,11 @@ package cmd import ( + "os" + "os/signal" + "runtime" + "syscall" + "github.com/InazumaV/V2bX/conf" vCore "github.com/InazumaV/V2bX/core" "github.com/InazumaV/V2bX/limiter" @@ -8,10 +13,6 @@ import ( log "github.com/sirupsen/logrus" "github.com/spf13/cobra" "gopkg.in/natefinch/lumberjack.v2" - "os" - "os/signal" - "runtime" - "syscall" ) var ( @@ -95,6 +96,7 @@ func serverHandle(_ *cobra.Command, _ []string) { log.WithField("err", err).Error("Restart node failed") return } + runtime.GC() vc, err = vCore.NewCore(c.CoresConfig) if err != nil { log.WithField("err", err).Error("New core failed") @@ -112,7 +114,6 @@ func serverHandle(_ *cobra.Command, _ []string) { return } log.Info("Nodes restarted") - runtime.GC() }) if err != nil { log.WithField("err", err).Error("start watch failed") diff --git a/node/controller.go b/node/controller.go index 095dbfd..e8aa29d 100644 --- a/node/controller.go +++ b/node/controller.go @@ -110,6 +110,10 @@ func (c *Controller) Close() error { if c.onlineIpReportPeriodic != nil { c.onlineIpReportPeriodic.Close() } + err := c.server.DelNode(c.tag) + if err != nil { + return fmt.Errorf("del node error: %s", err) + } return nil }