diff options
| author | JP Dillingham <jp@dillingham.me> | 2025-07-11 17:51:34 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2025-07-11 17:51:34 -0500 |
| commit | 4b0b2d8336a71b8fac3da4ddbabde1f8dc6966b0 (patch) | |
| tree | 9799d355c1803ec4d3859d9143c56d69bf64700c | |
| parent | a9eed8e7c0b0810c6b81de844a2afdcd192e76d1 (diff) | |
| download | slskd-4b0b2d8336a71b8fac3da4ddbabde1f8dc6966b0.tar.gz | |
coalesce CancellationTokenSource
| -rw-r--r-- | src/slskd/Core/ConnectionWatchdog.cs | 6 |
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; } |
