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 -3
View File
@@ -7,10 +7,12 @@ internal sealed partial class MainForm
private readonly TailnetReadinessPolicy _tailnetReadiness = new();
private readonly ToolStripMenuItem _tailnetReconnectItem = new("优先内网重连(会重建连接)") { Enabled = false };
private void SetSessionToken(string? token)
private void SetSessionToken(string? token, DateTimeOffset? expiresAt = null)
{
_connectionAttemptCancellation?.Cancel();
_accessToken = token;
_connectionAuthorization.Reset(expiresAt, DateTimeOffset.UtcNow, Environment.TickCount64);
_connectionHealth.Invalidate();
_sessionRevision++;
_nodeTrafficPanel.Unavailable("等待当前账号采样", clear: true);
_nextNodeTrafficAttempt = DateTimeOffset.MinValue;
@@ -36,6 +38,9 @@ internal sealed partial class MainForm
_busy || _healthChecking || _uplinkChecking || _handoverOperating || _handover.Pending || _handover.Settling || _xray.IsTransitioning || _exiting,
_xray.IsRunning, _xray.UsesTailnet, !_currentNodeIsPrivateAuxiliary && _xray.TailnetProbeEndpoint is not null);
private bool CanRetainAuthorizedCore() => _connectionAuthorization.CanRetain(DateTimeOffset.UtcNow,
Environment.TickCount64, _currentNodeIsPrivateAuxiliary, _privateLeaseDeadlineTicks);
// The initial connection already tested this address. At ten-minute
// intervals repeat only the authorized IP ping; failure on the active path
// retries the same node's domain through the normal fresh-grant connector.
@@ -51,9 +56,10 @@ internal sealed partial class MainForm
try
{
if (_xray.TailnetProbeEndpoint is { } endpoint)
reachable = await TailnetTransport.ProbeEndpointAsync(endpoint.Address, endpoint.Port, _lifetime.Token);
reachable = await TailnetPingConfirmation.ProbeAsync(
pingToken => TailnetTransport.ProbeEndpointAsync(endpoint.Address, endpoint.Port, pingToken), _lifetime.Token);
}
catch (OperationCanceledException) { }
catch (OperationCanceledException) when (_lifetime.IsCancellationRequested) { return; }
catch (Exception) { /* Fixed diagnostics below contain no credentials. */ }
var result = _tailnetReadiness.Observe(ticket, ReadTailnetReadinessContext(), Environment.TickCount64, reachable);
if (_exiting || IsDisposed || Disposing) return;