From 6105a99e72c1917fb325cd7f0c95f45e10a0d350 Mon Sep 17 00:00:00 2001 From: Yaakov Date: Sat, 9 Sep 2017 23:57:02 +0300 Subject: [PATCH] Check for cancellation after semaphore completion MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It doesn’t look like anything actually calls Cancel() on this CancellationTokenSource, but if something ever does we’d want this to work properly. --- DepotDownloader/ContentDownloader.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DepotDownloader/ContentDownloader.cs b/DepotDownloader/ContentDownloader.cs index 9851e8c6..978ce197 100644 --- a/DepotDownloader/ContentDownloader.cs +++ b/DepotDownloader/ContentDownloader.cs @@ -695,10 +695,11 @@ namespace DepotDownloader var task = Task.Run( async () => { cts.Token.ThrowIfCancellationRequested(); - + try { await semaphore.WaitAsync().ConfigureAwait( false ); + cts.Token.ThrowIfCancellationRequested(); string fileFinalPath = Path.Combine( depot.installDir, file.FileName ); string fileStagingPath = Path.Combine( stagingDir, file.FileName );