Windows 0.3.4 connection resilience and fixed-grid source delta; no private history or other platform changes

This commit is contained in:
2026-11-05 03:41:46 +00:00
parent aff1a50d35
commit 991b029b37
25 changed files with 629 additions and 96 deletions
+9 -4
View File
@@ -140,14 +140,14 @@ internal sealed class XrayManager : IDisposable, IAsyncDisposable, IHandoverRunt
internal Task<bool> CheckProxyHealthAsync(CancellationToken token)
=> !IsRunning || _learningProbePort == 0 ? Task.FromResult(false)
: NodeHealthProbe.CheckAsync(token, _learningProbePort);
: NodeHealthProbe.CheckTransportAsync(token, _learningProbePort);
internal sealed record HealthResult(bool Healthy, bool ProxyHealthy, bool RepairAttempted);
internal sealed record HealthResult(bool Healthy, bool ProxyHealthy, bool RepairAttempted, bool BusinessUnavailable = false);
internal async Task<HealthResult> CheckHealthWithRepairAsync(CancellationToken token)
{
var expectedCore = CoreId;
if (await CheckHealthAsync(token)) return new(true, false, false);
if (_routeMode != "smart" || expectedCore is null || CoreId != expectedCore || _learningProbePort == 0)
if (expectedCore is null || CoreId != expectedCore || _learningProbePort == 0)
return new(false, false, false);
using var deadline = CancellationTokenSource.CreateLinkedTokenSource(token, _learningEpoch.Token);
deadline.CancelAfter(TimeSpan.FromSeconds(45));
@@ -155,9 +155,14 @@ internal sealed class XrayManager : IDisposable, IAsyncDisposable, IHandoverRunt
try
{
// A failing ordinary route is not proof that the proxy node is down.
if (!await NodeHealthProbe.CheckAsync(deadline.Token, _learningProbePort)) return new(false, false, false);
var proxy = await NodeHealthProbe.CheckReportAsync(deadline.Token, _learningProbePort);
if (!proxy.TransportReachable) return new(false, false, false);
proxyHealthy = true;
if (CoreId != expectedCore) return new(false, true, false);
// The forced proxy authenticated the same transport and received
// TLS/HTTP from at least one site. A site's outage is a business
// diagnostic, not evidence that this node needs to be replaced.
if (_routeMode != "smart" || !proxy.BusinessHealthy) return new(false, true, false, true);
AppPaths.WriteLog("普通智能路径异常,代理比较路径正常;先重新验证并热修复规则,不重启内核。");
await Task.WhenAll(new[] { "chatgpt.com", "api.openai.com", "www.google.com" }.Select(target =>
ScheduleLearningAsync(new LearningObservation { Target = target, Port = 443, AccessKind = "http",