mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2026-11-16 10:05:00 +03:00
fix(web): stop clean shutdowns logging false errors, and let the panel stop its children (#6884)
A systemd stop or restart logged "Server shutdown failed: use of closed network connection | xray is not running" on every clean exit. httpServer.Shutdown already closes the listener, so the second Close's net.ErrClosed is now ignored, and StopXray's not-running case is a sentinel (ErrXrayNotRunning) that Stop treats as done. The shipped units now use KillMode=mixed, so SIGTERM reaches only the panel, which stops Xray and the sidecars itself; systemd still SIGKILLs whatever is left after the stop timeout.
This commit is contained in:
@@ -96,6 +96,15 @@ func TestIntentionalStopDoesNotRecordExitError(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestStopWhenNotRunningReturnsErrXrayNotRunning(t *testing.T) {
|
||||
initProcessTestLogger(t)
|
||||
|
||||
p := NewProcess(&Config{})
|
||||
if err := p.Stop(); !errors.Is(err, ErrXrayNotRunning) {
|
||||
t.Fatalf("Stop() on unstarted process err = %v, want ErrXrayNotRunning", err)
|
||||
}
|
||||
}
|
||||
|
||||
func TestStopKillsProcessThatIgnoresSIGTERM(t *testing.T) {
|
||||
initProcessTestLogger(t)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user