From fee9cb7bc895dfc247b78ed3c617abad34f8ff15 Mon Sep 17 00:00:00 2001 From: gVisor bot Date: Mon, 10 Apr 2023 21:13:23 +0800 Subject: [PATCH] chore: cleanup listener before restart --- hub/route/restart.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/hub/route/restart.go b/hub/route/restart.go index 69b4f5b8..6c3f27f3 100644 --- a/hub/route/restart.go +++ b/hub/route/restart.go @@ -8,6 +8,7 @@ import ( "runtime" "syscall" + "github.com/Dreamacro/clash/listener" "github.com/Dreamacro/clash/log" "github.com/go-chi/chi/v5" @@ -43,7 +44,7 @@ func restart(w http.ResponseWriter, r *http.Request) { func runRestart(execPath string) { var err error - + listener.Cleanup(false) if runtime.GOOS == "windows" { cmd := exec.Command(execPath, os.Args[1:]...) log.Infoln("restarting: %q %q", execPath, os.Args[1:])