aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Core
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2025-07-11 17:51:34 -0500
committerJP Dillingham <jp@dillingham.me>2025-07-11 17:51:34 -0500
commit4b0b2d8336a71b8fac3da4ddbabde1f8dc6966b0 (patch)
tree9799d355c1803ec4d3859d9143c56d69bf64700c /src/slskd/Core
parenta9eed8e7c0b0810c6b81de844a2afdcd192e76d1 (diff)
downloadslskd-4b0b2d8336a71b8fac3da4ddbabde1f8dc6966b0.tar.gz
coalesce CancellationTokenSource
Diffstat (limited to 'src/slskd/Core')
-rw-r--r--src/slskd/Core/ConnectionWatchdog.cs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/slskd/Core/ConnectionWatchdog.cs b/src/slskd/Core/ConnectionWatchdog.cs
index 3954d0fc..7b4ecc62 100644
--- a/src/slskd/Core/ConnectionWatchdog.cs
+++ b/src/slskd/Core/ConnectionWatchdog.cs
@@ -213,7 +213,7 @@ namespace slskd
var approximateDelay = (int)Math.Ceiling((double)(delay + jitter) / 1000);
Log.Information($"Waiting about {(approximateDelay == 1 ? "a second" : $"{approximateDelay} seconds")} before attempting to reconnect");
- await Task.Delay(delay + jitter, cancellationToken: CancellationTokenSource.Token);
+ await Task.Delay(delay + jitter, cancellationToken: CancellationTokenSource?.Token ?? CancellationToken.None);
Log.Information("Attempting to reconnect to the Soulseek server (#{Attempts})...", attempts);
}
@@ -227,7 +227,7 @@ namespace slskd
// reconnect with the latest configuration values we have for username and password, instead of the
// options that were captured at startup. if a user has updated these values prior to the disconnect,
// the changes will take effect now.
- var opt = Options.CurrentValue.Soulseek;
+ var opt = OptionsMonitor.CurrentValue.Soulseek;
// note: cancelling the CTS before the connect logic is fully complete (e.g. reacting to the connect event)
// will cause the client to connect, then disconnect immediately
@@ -236,7 +236,7 @@ namespace slskd
port: opt.Port,
username: opt.Username,
password: opt.Password,
- cancellationToken: CancellationTokenSource.Token);
+ cancellationToken: CancellationTokenSource?.Token ?? CancellationToken.None);
break;
}