Move browser dialer start stop to instance lifecycle

Agent-Logs-Url: https://github.com/XTLS/Xray-core/sessions/b8c640ab-f93c-4609-8e34-a8e14e2be9e7

Co-authored-by: RPRX <63339210+RPRX@users.noreply.github.com>
This commit is contained in:
copilot-swe-agent[bot]
2026-04-27 13:32:47 +00:00
committed by GitHub
parent 3a826b7ece
commit 8043924af5
3 changed files with 31 additions and 3 deletions
+9
View File
@@ -18,6 +18,7 @@ import (
"github.com/xtls/xray-core/features/routing"
"github.com/xtls/xray-core/features/stats"
"github.com/xtls/xray-core/transport/internet"
"github.com/xtls/xray-core/transport/internet/browser_dialer"
)
// Server is an instance of Xray. At any time, there must be at most one Server instance running.
@@ -262,6 +263,9 @@ func (s *Instance) Close() error {
s.running = false
var errs []interface{}
if err := browser_dialer.StopCollectedDialerProxyURLs(); err != nil {
errs = append(errs, err)
}
for _, f := range s.features {
if err := f.Close(); err != nil {
errs = append(errs, err)
@@ -385,9 +389,14 @@ func (s *Instance) Start() error {
s.statusLock.Lock()
defer s.statusLock.Unlock()
if err := browser_dialer.StartCollectedDialerProxyURLs(); err != nil {
return err
}
s.running = true
for _, f := range s.features {
if err := f.Start(); err != nil {
s.running = false
_ = browser_dialer.StopCollectedDialerProxyURLs()
return err
}
}