aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJP Dillingham <jp@dillingham.me>2026-08-22 12:46:05 -0500
committerJP Dillingham <jp@dillingham.me>2026-08-22 12:46:05 -0500
commit858a458125dd2bb1cbb412192fd3399d2a2315c7 (patch)
treec05e505b116a89a4a3cfeecf5a9ca662e58f155b
parentc80e3f45201d8095f8952786ee69009d2793d91f (diff)
downloadslskd-858a458125dd2bb1cbb412192fd3399d2a2315c7.tar.gz
cancel downloads when enqueue timeout elapses
-rw-r--r--src/slskd/Transfers/Downloads/DownloadService.cs6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/slskd/Transfers/Downloads/DownloadService.cs b/src/slskd/Transfers/Downloads/DownloadService.cs
index a4d48279..30f3c9b1 100644
--- a/src/slskd/Transfers/Downloads/DownloadService.cs
+++ b/src/slskd/Transfers/Downloads/DownloadService.cs
@@ -550,6 +550,12 @@ namespace slskd.Transfers.Downloads
{
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
+ // 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();
});
// satisfies conditions #1 and #2