From 7745a97cca2ca7c37166e23b0177e5817c917f9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=96=E7=95=8C?= Date: Sun, 22 Feb 2026 23:27:25 +0800 Subject: [PATCH] daemon: Fix started service leak --- daemon/started_service.go | 8 ++++++++ experimental/libbox/command_server.go | 1 + 2 files changed, 9 insertions(+) diff --git a/daemon/started_service.go b/daemon/started_service.go index a42a752d..7c6fa945 100644 --- a/daemon/started_service.go +++ b/daemon/started_service.go @@ -207,6 +207,14 @@ func (s *StartedService) StartOrReloadService(profileContent string, options *Ov return nil } +func (s *StartedService) Close() { + s.serviceStatusSubscriber.Close() + s.logSubscriber.Close() + s.urlTestSubscriber.Close() + s.clashModeSubscriber.Close() + s.connectionEventSubscriber.Close() +} + func (s *StartedService) CloseService() error { s.serviceAccess.Lock() switch s.serviceStatus.Status { diff --git a/experimental/libbox/command_server.go b/experimental/libbox/command_server.go index 2b4ac71b..e3300281 100644 --- a/experimental/libbox/command_server.go +++ b/experimental/libbox/command_server.go @@ -159,6 +159,7 @@ func (s *CommandServer) Close() { s.grpcServer.Stop() } common.Close(s.listener) + s.StartedService.Close() } type OverrideOptions struct {