diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/slskd/Common/TokenBucket.cs | 4 | ||||
| -rw-r--r-- | src/slskd/Transfers/Downloads/DownloadService.cs | 2 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/slskd/Common/TokenBucket.cs b/src/slskd/Common/TokenBucket.cs index 11d64b88..440f25ae 100644 --- a/src/slskd/Common/TokenBucket.cs +++ b/src/slskd/Common/TokenBucket.cs @@ -92,7 +92,7 @@ namespace slskd /// </summary> public class TokenBucket : ITokenBucket, IDisposable { - private TaskCompletionSource<bool> waitForReset = new(); + private TaskCompletionSource<bool> waitForReset = new(TaskCreationOptions.RunContinuationsAsynchronously); /// <summary> /// Initializes a new instance of the <see cref="TokenBucket"/> class. @@ -243,6 +243,6 @@ namespace slskd } private void Reset() - => Interlocked.Exchange(ref waitForReset, new TaskCompletionSource<bool>()).SetResult(true); + => Interlocked.Exchange(ref waitForReset, new TaskCompletionSource<bool>(TaskCreationOptions.RunContinuationsAsynchronously)).SetResult(true); } } diff --git a/src/slskd/Transfers/Downloads/DownloadService.cs b/src/slskd/Transfers/Downloads/DownloadService.cs index 30f3c9b1..cb9423bc 100644 --- a/src/slskd/Transfers/Downloads/DownloadService.cs +++ b/src/slskd/Transfers/Downloads/DownloadService.cs @@ -509,7 +509,7 @@ namespace slskd.Transfers.Downloads add this to the dictionary before inserting the record, so we are guaranteed to have it in the right place once the transfer hits the UI */ - var enqueuedTcs = new TaskCompletionSource<Transfer>(); + var enqueuedTcs = new TaskCompletionSource<Transfer>(TaskCreationOptions.RunContinuationsAsynchronously); // satisfies condition #3; CancellationTokenSource set cancelled by the user (via API call) var cts = CancellationTokenSource.CreateLinkedTokenSource(cancellationToken); |
