diff options
| author | JP Dillingham <jp@dillingham.me> | 2022-06-28 09:54:04 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2022-06-28 09:54:04 -0500 |
| commit | 4143b4e4e9d42ecfbef9e2f7f71629f0c0725cae (patch) | |
| tree | 5487a7219b38f547299fe0583a6de20364690a57 /src | |
| parent | 50ccefed96b07455aedd98d75002c84df73275f1 (diff) | |
| download | slskd-4143b4e4e9d42ecfbef9e2f7f71629f0c0725cae.tar.gz | |
fix check of re-download requests
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Application.cs | 15 |
1 files changed, 7 insertions, 8 deletions
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 /// </exception> 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( |
