diff --git a/Source/AaxDecrypter/NetworkFileStream.cs b/Source/AaxDecrypter/NetworkFileStream.cs index eaab46f1..8f2079f1 100644 --- a/Source/AaxDecrypter/NetworkFileStream.cs +++ b/Source/AaxDecrypter/NetworkFileStream.cs @@ -412,7 +412,6 @@ namespace AaxDecrypter var toRead = Math.Min(count, Length - Position); WaitToPosition(Position + toRead); - return _readFile.Read(buffer, offset, count); } @@ -435,11 +434,13 @@ namespace AaxDecrypter /// The minimum required flished data length in . private void WaitToPosition(long requiredPosition) { - while (requiredPosition > WritePosition + while (WritePosition < requiredPosition && hasBegunDownloading && !IsCancelled - && !downloadEnded.WaitOne(0) - && !downloadedPiece.WaitOne(100)) ; + && !downloadEnded.WaitOne(0)) + { + downloadedPiece.WaitOne(100); + } } public override void Close()