From 52a411477d89aa8bc128383725b9846d8fb6d791 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Thu, 12 Nov 2026 18:59:48 -0600 Subject: document cts registration behavior --- src/slskd/Transfers/Downloads/DownloadService.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/slskd/Transfers/Downloads/DownloadService.cs b/src/slskd/Transfers/Downloads/DownloadService.cs index 2b8bbf8d..d4b07878 100644 --- a/src/slskd/Transfers/Downloads/DownloadService.cs +++ b/src/slskd/Transfers/Downloads/DownloadService.cs @@ -549,13 +549,12 @@ namespace slskd.Transfers.Downloads using var timeoutCts = new CancellationTokenSource(maxTimeToWaitForEnqueueRequestAck); timeoutCts.Token.Register(() => { + // note: disposed once we leave the try block, so registration doesn't fire unless it actually times out Log.Warning("Download of {Filename} from {Username} failed to enqueue remotely after hard time limit of {Duration} seconds. State transition history: {History}", transfer.Filename, username, maxTimeToWaitForEnqueueRequestAck.TotalSeconds, string.Join(", ", transitions)); enqueuedTcs.TrySetException(new TimeoutException($"Download failed to enqueue remotely after hard time limit of {maxTimeToWaitForEnqueueRequestAck.TotalSeconds} secs")); - // cancel the download attempt so that it doesn't keep running and cause the internal + // cancel the download attempt so that it doesn't keep running (within Soulseek.NET) and cause the internal // 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(swallowObjectDisposedException: true); }); -- cgit v1.2.3