aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/slskd/Core/ConnectionWatchdog.cs17
1 files changed, 12 insertions, 5 deletions
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
}
/// <summary>
- /// Starts monitoring the server connection.
+ /// Stops the watchdog and aborts any active reconnection loop, then starts again.
/// </summary>
- /// <remarks>This should be called when the connection is disconnected.</remarks>
- public void Restart()
+ /// <remarks>
+ /// This should be called when we have a reason to restart an in-process retry loop, such as a setting change,
+ /// user request, etc.
+ /// </remarks>
+ public virtual void Restart()
{
- WatchdogTimer.Enabled = true;
- _ = AttemptReconnect(attempts: 1);
+ if (IsEnabled)
+ {
+ Log.Information("(Re)connection process restarted");
+ Stop(abortReconnect: true);
+ Start();
+ }
}
/// <summary>