mirror of
https://github.com/MHSanaei/3x-ui.git
synced 2025-08-23 03:16:52 +00:00
renamed func
This commit is contained in:
parent
a72c86d0f3
commit
ea6acda451
2 changed files with 6 additions and 4 deletions
|
@ -16,7 +16,7 @@ func NewCheckXrayRunningJob() *CheckXrayRunningJob {
|
||||||
}
|
}
|
||||||
|
|
||||||
func (j *CheckXrayRunningJob) Run() {
|
func (j *CheckXrayRunningJob) Run() {
|
||||||
if !j.xrayService.IsNeedToResurrect() {
|
if !j.xrayService.DidXrayCrash() {
|
||||||
j.checkTime = 0
|
j.checkTime = 0
|
||||||
} else {
|
} else {
|
||||||
j.checkTime++
|
j.checkTime++
|
||||||
|
|
|
@ -16,7 +16,7 @@ var (
|
||||||
p *xray.Process
|
p *xray.Process
|
||||||
lock sync.Mutex
|
lock sync.Mutex
|
||||||
isNeedXrayRestart atomic.Bool // Indicates that restart was requested for Xray
|
isNeedXrayRestart atomic.Bool // Indicates that restart was requested for Xray
|
||||||
isManuallyStopped atomic.Bool // Indicates that Xray was stopped manually (i.e. didn't crash)
|
isManuallyStopped atomic.Bool // Indicates that Xray was stopped manually from the panel
|
||||||
result string
|
result string
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -39,6 +39,7 @@ func (s *XrayService) GetXrayErr() error {
|
||||||
|
|
||||||
if runtime.GOOS == "windows" && err.Error() == "exit status 1" {
|
if runtime.GOOS == "windows" && err.Error() == "exit status 1" {
|
||||||
// exit status 1 on Windows means that Xray process was killed
|
// exit status 1 on Windows means that Xray process was killed
|
||||||
|
// as we kill process to stop in on Windows, this is not an error
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,6 +61,7 @@ func (s *XrayService) GetXrayResult() string {
|
||||||
|
|
||||||
if runtime.GOOS == "windows" && result == "exit status 1" {
|
if runtime.GOOS == "windows" && result == "exit status 1" {
|
||||||
// exit status 1 on Windows means that Xray process was killed
|
// exit status 1 on Windows means that Xray process was killed
|
||||||
|
// as we kill process to stop in on Windows, this is not an error
|
||||||
return ""
|
return ""
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -246,7 +248,7 @@ func (s *XrayService) IsNeedRestartAndSetFalse() bool {
|
||||||
return isNeedXrayRestart.CompareAndSwap(true, false)
|
return isNeedXrayRestart.CompareAndSwap(true, false)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check if Xray is not running and wasn't stopped manually
|
// Check if Xray is not running and wasn't stopped manually, i.e. crashed
|
||||||
func (s *XrayService) IsNeedToResurrect() bool {
|
func (s *XrayService) DidXrayCrash() bool {
|
||||||
return !s.IsXrayRunning() && !isManuallyStopped.Load()
|
return !s.IsXrayRunning() && !isManuallyStopped.Load()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue