diff options
| author | JP Dillingham <jp@dillingham.me> | 2025-09-23 18:58:29 -0500 |
|---|---|---|
| committer | JP Dillingham <jp@dillingham.me> | 2025-09-23 18:58:29 -0500 |
| commit | 0b2e019e0d1fd5522afcf2e795427af822447482 (patch) | |
| tree | de65420a238f33f24bd468bfec7318c0a673475f /src | |
| parent | 29a158df5b94a2ffd2e4581e729a22d8793fbab3 (diff) | |
| download | slskd-0b2e019e0d1fd5522afcf2e795427af822447482.tar.gz | |
tweak duplicate check
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Transfers/Uploads/UploadService.cs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/slskd/Transfers/Uploads/UploadService.cs b/src/slskd/Transfers/Uploads/UploadService.cs index 84152b59..5e0db336 100644 --- a/src/slskd/Transfers/Uploads/UploadService.cs +++ b/src/slskd/Transfers/Uploads/UploadService.cs @@ -518,11 +518,20 @@ namespace slskd.Transfers.Uploads */ if (existingInProgressRecords.Count != 0) { - Log.Information("Upload of {Filename} to {Username} is already queued or is in progress (ids: {Ids})", filename, username, string.Join(", ", existingInProgressRecords)); + Log.Information("Upload of {Filename} to {Username} is already queued or is in progress (ids: {Ids})", filename, username, string.Join(", ", existingInProgressRecords.Select(t => t.Id))); return null; } /* + check the tracked upload 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 + */ + if (Client.Uploads.Any(u => u.Username == username && u.Filename == filename)) + { + throw new DuplicateTransferException("A duplicate upload of the same file to the same user is already registered"); + } + + /* no existing transfers. next, check to see if they are requesting a file we are sharing we do this after checking the database because database I/O is "cheaper" than disk and potentially |
