From d322aa6ede0fd025dd09fc9d80be613ff7da227a Mon Sep 17 00:00:00 2001 From: Loren Eteval Date: Mon, 28 Aug 2023 11:16:52 +0800 Subject: [PATCH] Add logging when custom routing object not found Signed-off-by: Loren Eteval --- Furious/Action/Connect.py | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) diff --git a/Furious/Action/Connect.py b/Furious/Action/Connect.py index 3a89099..53d603e 100644 --- a/Furious/Action/Connect.py +++ b/Furious/Action/Connect.py @@ -174,10 +174,15 @@ class ConnectAction(Action): ) def stopCore(self): + self.XrayCore.registerExitCallback(None) + self.Hysteria.registerExitCallback(None) + # Stop any potentially running core self.XrayCore.stop() self.Hysteria.stop() + self.coreRunning = False + def showConnectingProgressBar(self): if APP().ShowProgressBarWhenConnecting == Switch.ON_: self.connectingProgressBar.progressBar.setValue(0) @@ -242,9 +247,6 @@ class ConnectAction(Action): def reset(self): # Reset everything - self.XrayCore.registerExitCallback(None) - self.Hysteria.registerExitCallback(None) - self.stopCore() self.hideConnectingProgressBar() @@ -448,9 +450,13 @@ class ConnectAction(Action): logger.info(f'RoutingObject: {route[XrayCore.name()]}') self.coreJSON['routing'] = route[XrayCore.name()] - except Exception: + except Exception as ex: # Any non-exit exceptions + logger.error( + f'get custom routing object failed: {ex}. Fast fail' + ) + # Fast fail self.coreJSON = {} @@ -523,9 +529,13 @@ class ConnectAction(Action): Hysteria.rule(route[Hysteria.name()].get('acl')), Hysteria.mmdb(route[Hysteria.name()].get('mmdb')), ) - except Exception: + except Exception as ex: # Any non-exit exceptions + logger.error( + f'get custom routing object failed: {ex}. Fast fail' + ) + # Fast fail self.Hysteria.start('', '', '') @@ -686,8 +696,7 @@ class ConnectAction(Action): # 1. No valid HTTP proxy endpoint. reset / disconnect has been called if self.isConnecting(): - # 2. Core has exited. disconnectReason must not be empty - assert self.disconnectReason + # 2. Core has exited self.disconnectAction(self.disconnectReason)