diff options
| author | JP Dillingham <jp@dillingham.me> | 2026-02-07 18:45:06 -0600 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2026-02-07 18:45:06 -0600 |
| commit | 6d9101e57714e67d0e628f4e03c1a87b9b336f33 (patch) | |
| tree | bdce9a59d950455ecd13dff0efca34fc768cf0cb /src | |
| parent | fb757c4d789390ae3c838be46c356cb70fdb6aa1 (diff) | |
| download | slskd-6d9101e57714e67d0e628f4e03c1a87b9b336f33.tar.gz | |
add flag to indicate when watchdog is awaiting vpn
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Core/ConnectionWatchdog.cs | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/src/slskd/Core/ConnectionWatchdog.cs b/src/slskd/Core/ConnectionWatchdog.cs index 0cf30484..6250a0ba 100644 --- a/src/slskd/Core/ConnectionWatchdog.cs +++ b/src/slskd/Core/ConnectionWatchdog.cs @@ -83,6 +83,11 @@ namespace slskd /// </summary> public bool IsAttemptingConnection => SyncRoot.CurrentCount == 0; + /// <summary> + /// Gets a value indicating whether the watchdog is waiting for the VPN client to connect. + /// </summary> + public bool IsAwaitingVpn { get; private set; } + private ISoulseekClient Client { get; } private VPNService VPN { get; } private bool Disposed { get; set; } @@ -193,6 +198,7 @@ namespace slskd { IsEnabled = IsEnabled, IsAttemptingConnection = IsAttemptingConnection, + IsAwaitingVpn = IsAwaitingVpn, NextAttemptAt = IsAttemptingConnection ? nextAttemptAt ?? state.ConnectionWatchdog.NextAttemptAt : null, // only null this if we're not attempting, otherwise it sticks }, }); @@ -218,8 +224,6 @@ namespace slskd { try { - Log.Debug("AttemptConnection initiated by {Source}", source); - /* go until we connect and break, or something stops the watchdog. why don't we just use the timer here? good question. we could, but a loop gives us more control and precision. at the expensive of needing to @@ -243,10 +247,12 @@ namespace slskd if (OptionsAtStartup.Integration.Vpn.Required && !VPN.IsReady) { - Log.Debug("AttemptConnection aborted; VPN is not yet ready (status: {Status})", VPN.Status); + IsAwaitingVpn = true; return; } + IsAwaitingVpn = false; + CancellationTokenSource = new CancellationTokenSource(); if (attempts > 0) |
