From 83adbb027fba5fdc98234361db16361cbf8af41a Mon Sep 17 00:00:00 2001 From: Vxrtrauter Date: Mon, 19 Jan 2026 13:49:20 +0100 Subject: [PATCH] fix aria2 connection refused errors caused by autoresume --- core/network/aria2_integration.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/core/network/aria2_integration.py b/core/network/aria2_integration.py index 9f0aba3..77fa6eb 100644 --- a/core/network/aria2_integration.py +++ b/core/network/aria2_integration.py @@ -4,6 +4,7 @@ from core.utils.data.state import state from core.utils.general.logs import update_download_completed_by_hash from core.utils.general.logs import consoleLog from plyer import notification +import socket import time import sys @@ -42,6 +43,21 @@ def aria2server(): stderr=subprocess.DEVNULL, creationflags=subprocess.CREATE_NO_WINDOW if sys.platform == 'win32' else 0 ) + + max_checks = 50 + for check in range(max_checks): + try: + sock = socket.socket() + sock.settimeout(0.1) + sock.connect(("localhost", 6800)) + sock.close() + break + except(ConnectionRefusedError, socket.timeout): + time.sleep(0.1) + else: + raise RuntimeError("Aria2 Server failed to start") + + consoleLog("Aria2 Server started") return aria2server def dlprogress():