Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion HandheldCompanion/Managers/UpdateManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ public enum UpdateStatus
private static string updateUrl = string.Empty;
private static readonly HttpClient httpClient;
private static readonly string InstallPath;
private static readonly TimeSpan DownloadReadTimeout = TimeSpan.FromSeconds(30);

private static Timer autoTimer = new(TimeSpan.FromMinutes(10)) { AutoReset = true };

Expand Down Expand Up @@ -280,7 +281,7 @@ public static async Task DownloadUpdateFile(UpdateFile update)
var buffer = new byte[81920];
long bytesReadSoFar = 0;
int read;
while ((read = await sourceStream.ReadAsync(buffer, 0, buffer.Length)) > 0)
while ((read = await sourceStream.ReadAsync(buffer, 0, buffer.Length).WaitAsync(DownloadReadTimeout)) > 0)
{
await destStream.WriteAsync(buffer, 0, read);
bytesReadSoFar += read;
Expand Down