diff options
| author | JP Dillingham <jp@dillingham.me> | 2026-11-12 18:26:40 -0600 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2026-11-12 18:26:40 -0600 |
| commit | a65269cc9163b1c83be426fbcf98fd529f44b789 (patch) | |
| tree | 8fad6668a695d26c8be4c34e7279960df4cabeb0 /src | |
| parent | e7245732ddae9222283fec370a96370036ba7a08 (diff) | |
| download | slskd-a65269cc9163b1c83be426fbcf98fd529f44b789.tar.gz | |
swallow object disposed when cancelling
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Application.cs | 4 | ||||
| -rw-r--r-- | src/slskd/Core/API/Controllers/ApplicationController.cs | 4 | ||||
| -rw-r--r-- | src/slskd/Relay/RelayClient.cs | 2 | ||||
| -rw-r--r-- | src/slskd/Search/SearchService.cs | 2 | ||||
| -rw-r--r-- | src/slskd/Shares/ShareScanner.cs | 2 | ||||
| -rw-r--r-- | src/slskd/Transfers/Downloads/DownloadService.cs | 2 | ||||
| -rw-r--r-- | src/slskd/Transfers/Uploads/UploadService.cs | 2 |
7 files changed, 9 insertions, 9 deletions
diff --git a/src/slskd/Application.cs b/src/slskd/Application.cs index 461a5fef..208de9e1 100644 --- a/src/slskd/Application.cs +++ b/src/slskd/Application.cs @@ -128,7 +128,7 @@ namespace slskd Console.CancelKeyPress += (_, args) => { ShuttingDown = true; - Program.MasterCancellationTokenSource.Cancel(); + Program.MasterCancellationTokenSource.Cancel(swallowObjectDisposedException: true); Log.Warning("Received SIGINT"); }; @@ -137,7 +137,7 @@ namespace slskd PosixSignals.Add(PosixSignalRegistration.Create(signal, context => { ShuttingDown = true; - Program.MasterCancellationTokenSource.Cancel(); + Program.MasterCancellationTokenSource.Cancel(swallowObjectDisposedException: true); Log.Fatal("Received {Signal}", signal); Environment.Exit(1); })); diff --git a/src/slskd/Core/API/Controllers/ApplicationController.cs b/src/slskd/Core/API/Controllers/ApplicationController.cs index e015e612..09d9eda2 100644 --- a/src/slskd/Core/API/Controllers/ApplicationController.cs +++ b/src/slskd/Core/API/Controllers/ApplicationController.cs @@ -94,7 +94,7 @@ namespace slskd.Core.API [Authorize(Policy = AuthPolicy.JwtOnly, Roles = AuthRole.AdministratorOnly)] public IActionResult Shutdown() { - Program.MasterCancellationTokenSource.Cancel(); + Program.MasterCancellationTokenSource.Cancel(swallowObjectDisposedException: true); Lifetime.StopApplication(); Task.Run(async () => @@ -114,7 +114,7 @@ namespace slskd.Core.API [Authorize(Policy = AuthPolicy.JwtOnly, Roles = AuthRole.AdministratorOnly)] public IActionResult Restart() { - Program.MasterCancellationTokenSource.Cancel(); + Program.MasterCancellationTokenSource.Cancel(swallowObjectDisposedException: true); Process.Start(Process.GetCurrentProcess().MainModule.FileName, Environment.CommandLine); Lifetime.StopApplication(); diff --git a/src/slskd/Relay/RelayClient.cs b/src/slskd/Relay/RelayClient.cs index cbcde3c4..49935b4c 100644 --- a/src/slskd/Relay/RelayClient.cs +++ b/src/slskd/Relay/RelayClient.cs @@ -279,7 +279,7 @@ namespace slskd.Relay // if the client is attempting a connection, cancel it it's going to be dropped when we create a new instance, but // we need the retry loop around connection to stop. - StartCancellationTokenSource?.Cancel(); + StartCancellationTokenSource?.Cancel(swallowObjectDisposedException: true); HubConnection = new HubConnectionBuilder() .WithUrl($"{options.Relay.Controller.Address.TrimEnd('/')}/hub/relay", builder => diff --git a/src/slskd/Search/SearchService.cs b/src/slskd/Search/SearchService.cs index 8b107084..ec45bb5c 100644 --- a/src/slskd/Search/SearchService.cs +++ b/src/slskd/Search/SearchService.cs @@ -416,7 +416,7 @@ namespace slskd.Search { if (CancellationTokens.TryGetValue(id, out var cts)) { - cts.Cancel(); + cts.Cancel(swallowObjectDisposedException: true); return true; } diff --git a/src/slskd/Shares/ShareScanner.cs b/src/slskd/Shares/ShareScanner.cs index 98a3f092..7ae1aa4e 100644 --- a/src/slskd/Shares/ShareScanner.cs +++ b/src/slskd/Shares/ShareScanner.cs @@ -457,7 +457,7 @@ namespace slskd.Shares { if (CancellationTokenSource != null) { - CancellationTokenSource.Cancel(); + CancellationTokenSource.Cancel(swallowObjectDisposedException: true); return true; } diff --git a/src/slskd/Transfers/Downloads/DownloadService.cs b/src/slskd/Transfers/Downloads/DownloadService.cs index 5a5fe699..21e33523 100644 --- a/src/slskd/Transfers/Downloads/DownloadService.cs +++ b/src/slskd/Transfers/Downloads/DownloadService.cs @@ -555,7 +555,7 @@ namespace slskd.Transfers.Downloads // state of slskd to diverge from the internal state of Soulseek.NET. // the transfer record is recorded as being cancelled when this happens and there's not // an easy/good way to stop it. - cts.Cancel(); + cts.Cancel(swallowObjectDisposedException: true); }); // satisfies conditions #1 and #2 diff --git a/src/slskd/Transfers/Uploads/UploadService.cs b/src/slskd/Transfers/Uploads/UploadService.cs index 05251ecf..246f4b31 100644 --- a/src/slskd/Transfers/Uploads/UploadService.cs +++ b/src/slskd/Transfers/Uploads/UploadService.cs @@ -970,7 +970,7 @@ namespace slskd.Transfers.Uploads { if (CancellationTokens.TryRemove(id, out var cts)) { - cts.Cancel(); + cts.Cancel(swallowObjectDisposedException: true); return true; } |
