mirror of
https://github.com/LorenEteval/Furious.git
synced 2026-09-22 23:08:08 +03:00
Add SystemShuttingDown ErrorCode handling in core ExitCallback
Signed-off-by: Loren Eteval <loren.eteval@proton.me>
This commit is contained in:
@@ -97,6 +97,10 @@ class ConnectAction(Action):
|
||||
assert self.coreRunning
|
||||
assert self.coreName == XrayCore.name()
|
||||
|
||||
if exitcode == XrayCore.ExitCode.SystemShuttingDown:
|
||||
# System shutting down. Do nothing
|
||||
return
|
||||
|
||||
if exitcode == XrayCore.ExitCode.ConfigurationError:
|
||||
if not self.isConnecting():
|
||||
# Protect connecting action. Mandatory
|
||||
@@ -142,6 +146,10 @@ class ConnectAction(Action):
|
||||
assert self.coreRunning
|
||||
assert self.coreName == Hysteria.name()
|
||||
|
||||
if exitcode == Hysteria.ExitCode.SystemShuttingDown:
|
||||
# System shutting down. Do nothing
|
||||
return
|
||||
|
||||
if exitcode == Hysteria.ExitCode.ConfigurationError:
|
||||
if not self.isConnecting():
|
||||
# Protect connecting action. Mandatory
|
||||
@@ -182,6 +190,8 @@ class ConnectAction(Action):
|
||||
)
|
||||
|
||||
def stopCore(self):
|
||||
self.TorRelay.stop()
|
||||
|
||||
self.XrayCore.registerExitCallback(None)
|
||||
self.Hysteria.registerExitCallback(None)
|
||||
|
||||
@@ -189,8 +199,6 @@ class ConnectAction(Action):
|
||||
self.XrayCore.stop()
|
||||
self.Hysteria.stop()
|
||||
|
||||
self.TorRelay.stop()
|
||||
|
||||
self.coreRunning = False
|
||||
|
||||
def showConnectingProgressBar(self):
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
from Furious.Utility.Constants import PLATFORM, ROOT_DIR, DATA_DIR
|
||||
from Furious.Utility.Constants import PLATFORM
|
||||
from Furious.Utility.Utility import getAbsolutePath
|
||||
|
||||
from PySide6 import QtCore
|
||||
@@ -96,6 +96,8 @@ class XrayCore(Core):
|
||||
ConfigurationError = 23
|
||||
# Windows: 4294967295. Darwin, Linux: 255 (-1)
|
||||
ServerStartFailure = 4294967295 if PLATFORM == 'Windows' else 255
|
||||
# Windows shutting down
|
||||
SystemShuttingDown = 0x40010004
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
@@ -137,6 +139,8 @@ class Hysteria(Core):
|
||||
class ExitCode:
|
||||
ConfigurationError = 23
|
||||
RemoteNetworkError = 3
|
||||
# Windows shutting down
|
||||
SystemShuttingDown = 0x40010004
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
super().__init__(*args, **kwargs)
|
||||
|
||||
Reference in New Issue
Block a user