Fix progressCallback abort/exception handling during DownloadFileAsync

This commit is contained in:
Wizou 2023-04-25 13:19:15 +02:00
parent 7c7a2a0625
commit 6a75f0a9d8
2 changed files with 2 additions and 2 deletions

View file

@ -378,6 +378,7 @@ namespace WTelegram
await outputStream.WriteAsync(fileData.bytes, 0, fileData.bytes.Length);
maxOffsetSeen = Math.Max(maxOffsetSeen, offset + fileData.bytes.Length);
transmitted += fileData.bytes.Length;
progress?.Invoke(transmitted, fileSize);
}
catch (Exception)
{
@ -387,7 +388,6 @@ namespace WTelegram
finally
{
writeSem.Release();
progress?.Invoke(transmitted, fileSize);
}
}
lock (tasks) tasks.Remove(offset);