aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2026-02-07 18:45:19 -0600
committerJP Dillingham <jp@dillingham.me>2026-02-07 18:45:19 -0600
commit02a3a82cb2d14bc43102aea56437bab4a5d588b2 (patch)
treeb17ac6eacfc5e619b450cc3704d656bace1817c0
parent6d9101e57714e67d0e628f4e03c1a87b9b336f33 (diff)
downloadslskd-02a3a82cb2d14bc43102aea56437bab4a5d588b2.tar.gz
start and stop vpn polling
-rw-r--r--src/slskd/Core/ConnectionWatchdog.cs12
1 files changed, 12 insertions, 0 deletions
diff --git a/src/slskd/Core/ConnectionWatchdog.cs b/src/slskd/Core/ConnectionWatchdog.cs
index 6250a0ba..2dd2f791 100644
--- a/src/slskd/Core/ConnectionWatchdog.cs
+++ b/src/slskd/Core/ConnectionWatchdog.cs
@@ -115,6 +115,11 @@ namespace slskd
/// <remarks>This should be called at application startup.</remarks>
public virtual void Start()
{
+ if (OptionsAtStartup.Integration.Vpn.Enabled)
+ {
+ VPN.StartPolling();
+ }
+
WatchdogTimer.Enabled = true;
UpdateApplicationState();
@@ -147,6 +152,13 @@ namespace slskd
/// <remarks>This should be called when the application is reasonably certain that the connection is connected.</remarks>
public virtual void Stop(bool abortReconnect = false)
{
+ // if the VPN is required, we have to keep polling in the background so we can disconnect if it drops
+ // this is a belt-and-suspenders effort to ensure maximum protection in case someone doesn't have a kill switch
+ if (OptionsAtStartup.Integration.Vpn.Required)
+ {
+ VPN.StopPolling();
+ }
+
// stop the timer first to avoid having it start the connection process again when the cts is cancelled
WatchdogTimer.Enabled = false;
UpdateApplicationState();