diff options
| author | JP Dillingham <jp@dillingham.me> | 2026-02-15 13:51:09 -0600 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2026-02-15 13:51:09 -0600 |
| commit | c2fabe49233958d7a1c60929d7e7b251e8d617c2 (patch) | |
| tree | 5f4ed1ab5f721029d1d08354209ed30fb6a550c9 | |
| parent | 70f326c720c0a040f3bef6068f358b2b33eda2fd (diff) | |
| download | slskd-c2fabe49233958d7a1c60929d7e7b251e8d617c2.tar.gz | |
split check of existing record tracking; tracked in soulseek but not slskd is a bug
| -rw-r--r-- | src/slskd/Transfers/Downloads/DownloadService.cs | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/slskd/Transfers/Downloads/DownloadService.cs b/src/slskd/Transfers/Downloads/DownloadService.cs index caf4d9ec..e3ed4985 100644 --- a/src/slskd/Transfers/Downloads/DownloadService.cs +++ b/src/slskd/Transfers/Downloads/DownloadService.cs @@ -383,13 +383,10 @@ namespace slskd.Transfers.Downloads /* if there are any that haven't ended yet (checking a few ways out of paranoia), then there's already an existing transfer record covering this file, and we're already enqueued. nothing more to do! - - check the tracked download dictionary in Soulseek.NET to see if it knows about this already - it shouldn't, if the slskd database doesn't. but things could get desynced */ existingInProgressRecords.TryGetValue(file.Filename, out var existingInProgressRecord); - if (existingInProgressRecord is not null || Client.Downloads.Any(u => u.Username == username && u.Filename == file.Filename)) + if (existingInProgressRecord is not null) { Log.Debug("Ignoring concurrent download enqueue attempt; transfer for {Filename} from {Username} already in progress (id: {Id})", file.Filename, username, existingInProgressRecord.Id); failed.Add(file.Filename); @@ -397,6 +394,18 @@ namespace slskd.Transfers.Downloads } /* + check the tracked download dictionary in Soulseek.NET to see if it knows about this already + it shouldn't, if the slskd database doesn't. but things could get desynced, which is likely a bug + and we'd like to know about it + */ + if (Client.Downloads.Any(u => u.Username == username && u.Filename == file.Filename)) + { + Log.Warning("Ignoring concurrent download enqueue attempt; transfer for {Filename} from {Username} is tracked by the Soulseek client but not slskd", file.Filename, username); + failed.Add(file.Filename); + continue; + } + + /* add the transfer record to the database in the Queued | Locally state, and set the 'Removed' property of any existing transfer to 'true', allowing the new record to supersede any old record(s) on the UI |
