Windows 0.3.3 dashboard layout and speed presentation source delta; no private history or other platform changes

This commit is contained in:
2026-11-03 15:15:23 +00:00
parent bfe8d6c62a
commit aff1a50d35
32 changed files with 1673 additions and 652 deletions
+18 -31
View File
@@ -1,21 +1,19 @@
namespace UCVL.VPNPlus;
// Advisory only: detects an available authorized alternate, never starts/stops a
// core, changes routes, fetches grants, or turns a TCP result into proxy proof.
// The caller owns the snapshot and performs one read-only probe per ticket.
// One monotonic ten-minute check of the same authorized node. This pure policy
// never touches networking. Only a failed ACTIVE Tailnet path requests fallback;
// a recovered alternate is advisory and cannot replace a healthy domain session.
internal sealed class TailnetReadinessPolicy
{
internal readonly record struct Context(long Epoch, int? CoreId, bool Wanted,
bool Busy, bool Running, bool UsesTailnet, bool HasAuthorizedCandidate);
internal readonly record struct ProbeTicket(long Generation, long Sequence, long Epoch, int CoreId);
internal enum Result { Ignore, NotReady, Confirming, BecameReady, Ready }
internal enum Result { Ignore, NotReady, Confirming, BecameReady, Ready, Fallback }
internal const long IntervalMilliseconds = 30_000;
internal const long MaximumBackoffMilliseconds = 120_000;
private bool _bound, _inFlight;
internal const long IntervalMilliseconds = 10 * 60_000;
private bool _bound, _inFlight, _usesTailnet;
private long _generation, _sequence, _epoch, _nextDue;
private int? _core;
private int _successes, _failures;
internal bool IsReady { get; private set; }
internal long NextDue => _nextDue;
@@ -25,36 +23,31 @@ internal sealed class TailnetReadinessPolicy
_bound = _inFlight = IsReady = false;
_core = null;
_nextDue = 0;
_successes = _failures = 0;
}
private static bool Eligible(Context context) => context.Wanted && context.Running
&& context.CoreId is not null && !context.UsesTailnet && context.HasAuthorizedCandidate;
&& context.CoreId is not null && context.HasAuthorizedCandidate;
private void Synchronize(Context context)
private void Synchronize(Context context, long now)
{
if (!_bound || _epoch != context.Epoch || _core != context.CoreId)
if (!Eligible(context)) { Reset(); return; }
if (!_bound || _epoch != context.Epoch || _core != context.CoreId || _usesTailnet != context.UsesTailnet)
{
Reset();
_bound = true;
_epoch = context.Epoch;
_core = context.CoreId;
}
if (!Eligible(context) && (_inFlight || IsReady || _successes != 0 || _failures != 0))
{
// A grant withdrawal/disconnect must invalidate the outstanding
// ticket even when the process ID has not changed yet.
_generation++;
_inFlight = IsReady = false;
_nextDue = 0;
_successes = _failures = 0;
_usesTailnet = context.UsesTailnet;
// The initial path is tested by NodeTransportConnector. Do not
// repeat it immediately after the connection becomes established.
_nextDue = now + IntervalMilliseconds;
}
}
internal bool TryBegin(Context context, long now, out ProbeTicket ticket)
{
ticket = default;
Synchronize(context);
Synchronize(context, now);
if (!Eligible(context) || context.Busy || _inFlight || now < _nextDue) return false;
_inFlight = true;
ticket = new(_generation, ++_sequence, context.Epoch, context.CoreId!.Value);
@@ -63,7 +56,7 @@ internal sealed class TailnetReadinessPolicy
internal Result Observe(ProbeTicket ticket, Context context, long now, bool reachable)
{
Synchronize(context);
Synchronize(context, now);
if (!_inFlight || ticket.Generation != _generation || ticket.Sequence != _sequence
|| ticket.Epoch != context.Epoch || ticket.CoreId != context.CoreId || !Eligible(context))
return Result.Ignore;
@@ -75,15 +68,9 @@ internal sealed class TailnetReadinessPolicy
if (!reachable)
{
IsReady = false;
_successes = 0;
_failures = Math.Min(_failures + 1, 3);
_nextDue = now + Math.Min(MaximumBackoffMilliseconds,
IntervalMilliseconds * (1L << (_failures - 1)));
return Result.NotReady;
return context.UsesTailnet ? Result.Fallback : Result.NotReady;
}
_failures = 0;
_successes = Math.Min(_successes + 1, 2);
if (_successes < 2) return Result.Confirming;
if (context.UsesTailnet) return Result.Ready;
if (IsReady) return Result.Ready;
IsReady = true;
return Result.BecameReady;