From c2fabe49233958d7a1c60929d7e7b251e8d617c2 Mon Sep 17 00:00:00 2001 From: JP Dillingham Date: Sun, 15 Feb 2026 13:51:09 -0600 Subject: split check of existing record tracking; tracked in soulseek but not slskd is a bug --- src/slskd/Transfers/Downloads/DownloadService.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'src') 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,19 +383,28 @@ 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); continue; } + /* + 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) -- cgit v1.2.3