aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2025-07-11 17:50:30 -0500
committerJP Dillingham <jp@dillingham.me>2025-07-11 17:50:30 -0500
commit4667de5ef249bc3de93164c988c8721410907bc2 (patch)
tree91a9b193bd583ee394065601215777c44a071243 /src
parente5aad77d9d467620d5ffa3cce041f33bb1d1af9a (diff)
downloadslskd-4667de5ef249bc3de93164c988c8721410907bc2.tar.gz
adjust Restart()
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>