Update tun2socks exitcode handling

Signed-off-by: Loren Eteval <loren.eteval@proton.me>
This commit is contained in:
Loren Eteval
2023-09-07 00:15:56 +08:00
parent c2992d5839
commit 38ed89528b
2 changed files with 2 additions and 17 deletions
+2 -16
View File
@@ -229,29 +229,15 @@ class ConnectAction(Action):
# System shutting down. Do nothing
return
if exitcode == Tun2socks.ExitCode.TunnelStartFailure:
if not self.isConnecting():
# Protect connecting action. Mandatory
return self.disconnectAction(
f'{Hysteria.name()}: {_("Connection to server has been lost")}'
)
else:
self.coreRunning = False
self.disconnectReason = (
f'{Hysteria.name()}: {_("Connection to server has been lost")}'
)
return
if not self.isConnecting():
# Protect connecting action. Mandatory
self.disconnectAction(
f'{Hysteria.name()}: {_("Core terminated unexpectedly")}'
f'{Tun2socks.name()}: {_("Core terminated unexpectedly")}'
)
else:
self.coreRunning = False
self.disconnectReason = (
f'{Hysteria.name()}: {_("Core terminated unexpectedly")}'
f'{Tun2socks.name()}: {_("Core terminated unexpectedly")}'
)
def stopCore(self):
-1
View File
@@ -15,7 +15,6 @@ def startTun2socks(*args, **kwargs):
class Tun2socks(Core):
class ExitCode:
TunnelStartFailure = 1
# Windows shutting down
SystemShuttingDown = 0x40010004