Skip to content

Commit

Permalink
Check CanTimeout instead of catching exceptions
Browse files Browse the repository at this point in the history
  • Loading branch information
HebaruSan committed Sep 14, 2023
1 parent 666eec9 commit 008a7a0
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions Core/Net/ResumingWebClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -124,15 +124,12 @@ protected override void OnOpenReadCompleted(OpenReadCompletedEventArgs e)
log.DebugFormat("OnOpenReadCompleted got open stream, appending to {0}", destination);
using (var fileStream = new FileStream(destination, FileMode.Append, FileAccess.Write))
{
try
// file:// URLs don't support timeouts
if (netStream.CanTimeout)
{
log.DebugFormat("Default stream read timeout is {0}", netStream.ReadTimeout);
netStream.ReadTimeout = timeoutMs;
}
catch
{
// file:// URLs don't support timeouts
}
cancelTokenSrc = new CancellationTokenSource();
netStream.CopyTo(fileStream, new Progress<long>(bytesDownloaded =>
{
Expand Down

0 comments on commit 008a7a0

Please sign in to comment.