Windows 0.3.4 connection resilience and fixed-grid source delta; no private history or other platform changes
This commit is contained in:
@@ -11,7 +11,9 @@ internal sealed class TailnetReadinessPolicy
|
||||
internal enum Result { Ignore, NotReady, Confirming, BecameReady, Ready, Fallback }
|
||||
|
||||
internal const long IntervalMilliseconds = 10 * 60_000;
|
||||
internal const long ConfirmationMilliseconds = 5_000;
|
||||
private bool _bound, _inFlight, _usesTailnet;
|
||||
private int _failedRounds;
|
||||
private long _generation, _sequence, _epoch, _nextDue;
|
||||
private int? _core;
|
||||
internal bool IsReady { get; private set; }
|
||||
@@ -23,6 +25,7 @@ internal sealed class TailnetReadinessPolicy
|
||||
_bound = _inFlight = IsReady = false;
|
||||
_core = null;
|
||||
_nextDue = 0;
|
||||
_failedRounds = 0;
|
||||
}
|
||||
|
||||
private static bool Eligible(Context context) => context.Wanted && context.Running
|
||||
@@ -64,12 +67,19 @@ internal sealed class TailnetReadinessPolicy
|
||||
_nextDue = now + IntervalMilliseconds;
|
||||
// Do not publish a result obtained while connection/authorization state
|
||||
// is being changed. A new ticket can retry after the normal cadence.
|
||||
if (context.Busy) return Result.Ignore;
|
||||
if (context.Busy) { _failedRounds = 0; return Result.Ignore; }
|
||||
if (!reachable)
|
||||
{
|
||||
IsReady = false;
|
||||
return context.UsesTailnet ? Result.Fallback : Result.NotReady;
|
||||
if (!context.UsesTailnet) { _failedRounds = 0; return Result.NotReady; }
|
||||
if (++_failedRounds < 2)
|
||||
{
|
||||
_nextDue = now + ConfirmationMilliseconds;
|
||||
return Result.Confirming;
|
||||
}
|
||||
return Result.Fallback;
|
||||
}
|
||||
_failedRounds = 0;
|
||||
if (context.UsesTailnet) return Result.Ready;
|
||||
if (IsReady) return Result.Ready;
|
||||
IsReady = true;
|
||||
|
||||
Reference in New Issue
Block a user