From 4667de5ef249bc3de93164c988c8721410907bc2 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Fri, 11 Jul 2025 17:50:30 -0500 Subject: adjust Restart() --- src/slskd/Core/ConnectionWatchdog.cs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/slskd/Core/ConnectionWatchdog.cs b/src/slskd/Core/ConnectionWatchdog.cs index 819d9a49..2b4f6c21 100644 --- a/src/slskd/Core/ConnectionWatchdog.cs +++ b/src/slskd/Core/ConnectionWatchdog.cs @@ -101,13 +101,20 @@ namespace slskd } /// - /// Starts monitoring the server connection. + /// Stops the watchdog and aborts any active reconnection loop, then starts again. /// - /// This should be called when the connection is disconnected. - public void Restart() + /// + /// This should be called when we have a reason to restart an in-process retry loop, such as a setting change, + /// user request, etc. + /// + public virtual void Restart() { - WatchdogTimer.Enabled = true; - _ = AttemptReconnect(attempts: 1); + if (IsEnabled) + { + Log.Information("(Re)connection process restarted"); + Stop(abortReconnect: true); + Start(); + } } /// -- cgit v1.2.3