From 065095ffd3a0f8ec4e9969ac552bc62139493cda Mon Sep 17 00:00:00 2001 From: Loren Eteval Date: Tue, 5 Sep 2023 10:55:45 +0800 Subject: [PATCH] Add waitCore and waitTime option in Core.py Signed-off-by: Loren Eteval --- Furious/Core/Core.py | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/Furious/Core/Core.py b/Furious/Core/Core.py index 2e594e3..f8d0114 100644 --- a/Furious/Core/Core.py +++ b/Furious/Core/Core.py @@ -72,11 +72,15 @@ class Core: def start(self, *args, **kwargs): logger.info(f'{self.name()} {self.version()} started') - self._process = multiprocessing.Process(*args, **kwargs, daemon=True) + waitCore = kwargs.pop('waitCore', True) + waitTime = kwargs.pop('waitTime', 2000) + + self._process = multiprocessing.Process(**kwargs, daemon=True) self._process.start() - # Wait for the core to start up completely - QTest.qWait(2000) + if waitCore: + # Wait for the core to start up completely + QTest.qWait(waitTime) if self.checkAlive(): # Start core daemon @@ -134,11 +138,8 @@ class XrayCore(Core): return '0.0.0' - def start(self, json): - super().start( - target=startXrayCore, - args=(json,), - ) + def start(self, json, **kwargs): + super().start(target=startXrayCore, args=(json,), **kwargs) def startHysteria(json, rule, mmdb): @@ -213,8 +214,5 @@ class Hysteria(Core): return '0.0.0' - def start(self, json, rule, mmdb): - super().start( - target=startHysteria, - args=(json, rule, mmdb), - ) + def start(self, json, rule, mmdb, **kwargs): + super().start(target=startHysteria, args=(json, rule, mmdb), **kwargs)