From 6d9101e57714e67d0e628f4e03c1a87b9b336f33 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sat, 7 Feb 2026 18:45:06 -0600 Subject: add flag to indicate when watchdog is awaiting vpn --- src/slskd/Core/ConnectionWatchdog.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'src') 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 /// public bool IsAttemptingConnection => SyncRoot.CurrentCount == 0; + /// + /// Gets a value indicating whether the watchdog is waiting for the VPN client to connect. + /// + 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) -- cgit v1.2.3