From 68bb55e7d4923c5b866258acc3997edbfcd0fba4 Mon Sep 17 00:00:00 2001 From: codeking Date: Tue, 18 Nov 2025 06:44:57 +0100 Subject: [PATCH] Improve connection status determination logic --- core/controllers/ConnectionController.py | 26 +++++++++++++++++++----- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/core/controllers/ConnectionController.py b/core/controllers/ConnectionController.py index a1d5a85..7311fa4 100644 --- a/core/controllers/ConnectionController.py +++ b/core/controllers/ConnectionController.py @@ -402,16 +402,32 @@ class ConnectionController: @staticmethod def __test_connection(port_number: Optional[int] = None, timeout: float = 10.0): - timeout = float(timeout) proxies = None + request_urls = [Constants.PING_URL] + timeout = float(timeout) if port_number is not None: proxies = ConnectionController.get_proxies(port_number) - try: - requests.get(Constants.PING_URL, timeout=timeout, proxies=proxies) - except requests.exceptions.RequestException: - raise ConnectionError('The connection could not be established.') + if os.environ.get('PING_URL') is None: + + request_urls.extend([ + 'https://hc1.simplifiedprivacy.net', + 'https://hc2.simplifiedprivacy.org', + 'https://hc3.hydraveil.net' + ]) + + for request_url in request_urls: + + try: + + requests.get(request_url, timeout=timeout, proxies=proxies) + return None + + except requests.exceptions.RequestException: + pass + + raise ConnectionError('The connection could not be established.') @staticmethod def __should_renegotiate(profile: Union[SessionProfile, SystemProfile]):