From 4143b4e4e9d42ecfbef9e2f7f71629f0c0725cae Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Tue, 28 Jun 2022 09:54:04 -0500 Subject: fix check of re-download requests --- src/slskd/Application.cs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) (limited to 'src') diff --git a/src/slskd/Application.cs b/src/slskd/Application.cs index 4e6444a3..d7078bde 100644 --- a/src/slskd/Application.cs +++ b/src/slskd/Application.cs @@ -619,6 +619,13 @@ namespace slskd /// private async Task EnqueueDownloadAction(string username, IPEndPoint endpoint, string filename, ITransferTracker tracker) { + // remote clients might sometimes re-request downloads to check the status. don't try to add the download again + // if it is already tracked. + if (tracker.Contains(TransferDirection.Upload, username, filename)) + { + return; + } + _ = endpoint; string localFilename; FileInfo fileInfo = default; @@ -642,14 +649,6 @@ namespace slskd throw new DownloadEnqueueException($"File not shared."); } - // TODO: fix this; it doesn't work. reproduce by downloading a file, then re-requesting the same file. - if (tracker.TryGet(TransferDirection.Upload, username, localFilename, out _)) - { - // in this case, a re-requested file is a no-op. normally we'd want to respond with a PlaceInQueueResponse - Console.WriteLine($"[UPLOAD RE-REQUESTED] [{username}/{filename}]"); - return; - } - // create a new cancellation token source so that we can cancel the upload from the UI. var cts = new CancellationTokenSource(); var topts = new TransferOptions( -- cgit v1.2.3