From b11780dec3024358489b96e4c722d6e0b81d8c42 Mon Sep 17 00:00:00 2001 From: Dushnilin Date: Mon, 10 Aug 2026 18:27:38 +0300 Subject: [PATCH] =?UTF-8?q?fix:=20=D0=B6=D0=B4=D0=B0=D1=82=D1=8C=20TCP-?= =?UTF-8?q?=D0=B3=D0=BE=D1=82=D0=BE=D0=B2=D0=BD=D0=BE=D1=81=D1=82=D0=B8=20?= =?UTF-8?q?proxy=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B4=20=D0=B7=D0=B0=D0=B3?= =?UTF-8?q?=D1=80=D1=83=D0=B7=D0=BA=D0=BE=D0=B9=20=D0=BE=D1=82=D0=BB=D0=BE?= =?UTF-8?q?=D0=B6=D0=B5=D0=BD=D0=BD=D1=8B=D1=85=20=D0=BF=D0=BE=D0=B4=D0=BF?= =?UTF-8?q?=D0=B8=D1=81=D0=BE=D0=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit run_deferred_subscription_bootstrap теперь после проверки что процесс sing-box запущен дополнительно проверяет что proxy-порт реально принимает соединения (до 10x3s). Без этого: если порт не готов в момент вызова — fallback на прямой download, что провалится для URL доступных только через proxy. При неудаче через 30s запускается retry worker (поведение сохранено). Также: get_subscription_download_proxy_address делает одиночную проверку порта — retry worker является safety net для edge cases. --- fe-app-tachyon/package.json | 2 +- tachyon/files/usr/lib/subscription/cache.uc | 32 +++++++++++++++++++-- 2 files changed, 30 insertions(+), 4 deletions(-) diff --git a/fe-app-tachyon/package.json b/fe-app-tachyon/package.json index 2a233852..22ba0820 100644 --- a/fe-app-tachyon/package.json +++ b/fe-app-tachyon/package.json @@ -1,6 +1,6 @@ { "name": "fe-app-tachyon", - "version": "1.2.68", + "version": "1.2.69", "license": "MIT", "type": "module", "scripts": { diff --git a/tachyon/files/usr/lib/subscription/cache.uc b/tachyon/files/usr/lib/subscription/cache.uc index 6a752d77..1fcd21e0 100644 --- a/tachyon/files/usr/lib/subscription/cache.uc +++ b/tachyon/files/usr/lib/subscription/cache.uc @@ -2475,21 +2475,47 @@ function run_deferred_subscription_bootstrap(deferred_sections) { return; log_message("Waiting for sing-box service proxy before retrying deferred subscription rule(s): " + deferred_sections, "info"); - let ready = false; + let process_ready = false; for (let attempt = 1; attempt <= 10; attempt++) { if (sing_box_service_running()) { - ready = true; + process_ready = true; break; } system("sleep 1"); } - if (!ready) { + if (!process_ready) { log_message("sing-box service proxy did not become ready in time; deferred subscription rule(s) will remain disabled until the next successful subscription update", "warn"); start_deferred_subscription_bootstrap_retry_worker(deferred_sections); return; } + // Wait for the proxy port to actually accept TCP connections — the sing-box + // process may be running but the mixed inbound port not yet ready. Without + // this check, the deferred download falls back to a direct connection that + // may fail for subscription URLs only reachable through the proxy. + let proxy_address = SB_SERVICE_MIXED_INBOUND_ADDRESS + ":" + SB_SERVICE_MIXED_INBOUND_PORT; + let port_ready = false; + for (let attempt = 1; attempt <= 10; attempt++) { + let probe = command_status_from_args([ + "curl", "-s", "--connect-timeout", "2", "-m", "4", + "-x", "http://" + proxy_address, "http://1.1.1.1/", "-o", "/dev/null" + ]); + if (probe != 7 && probe != 28) { + log_message("Service proxy is ready for deferred subscription bootstrap", "info"); + port_ready = true; + break; + } + log_message("Service proxy port not yet ready for deferred bootstrap [" + attempt + "/10]", "info"); + system("sleep 3"); + } + + if (!port_ready) { + log_message("Service proxy port is not accepting connections; starting bootstrap retry worker for: " + deferred_sections, "warn"); + start_deferred_subscription_bootstrap_retry_worker(deferred_sections); + return; + } + let result = subscription_bootstrap_retry_result(deferred_sections); if (result.recovered != "") { log_message("Recovered deferred subscription rule(s): " + result.recovered + "; scheduling Tachyon reload", "info");