Publish reviewed history-free open-source snapshot (2026-10-12)
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
namespace UCVL.VPNPlus;
|
||||
|
||||
internal static class ConnectionRecoveryPolicy
|
||||
{
|
||||
// A control-plane timeout is not evidence that the existing data-plane
|
||||
// process needs to be destroyed. Revoked authorization still stops service.
|
||||
internal static bool KeepExisting(bool reconnect, bool replacementStarted, bool coreRunning, Exception failure)
|
||||
=> reconnect && !replacementStarted && coreRunning
|
||||
&& failure is not ApiException { StatusCode: 401 or 403 };
|
||||
|
||||
internal static bool SelfTest()
|
||||
{
|
||||
var timeout = new TimeoutException();
|
||||
return KeepExisting(true, false, true, timeout)
|
||||
&& KeepExisting(true, false, true, new TaskCanceledException())
|
||||
&& !KeepExisting(false, false, true, timeout)
|
||||
&& !KeepExisting(true, true, true, timeout)
|
||||
&& !KeepExisting(true, false, false, timeout)
|
||||
&& !KeepExisting(true, false, true, new ApiException(401, "test revoked"))
|
||||
&& !KeepExisting(true, false, true, new ApiException(403, "test forbidden"));
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user