Exit download loop if zero bytes are read.
This commit is contained in:
parent
f8f5eac109
commit
984119c7ee
@ -221,9 +221,10 @@ namespace AaxDecrypter
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
int bytesRead;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
var bytesRead = _networkStream.Read(buff, 0, DOWNLOAD_BUFF_SZ);
|
bytesRead = _networkStream.Read(buff, 0, DOWNLOAD_BUFF_SZ);
|
||||||
_writeFile.Write(buff, 0, bytesRead);
|
_writeFile.Write(buff, 0, bytesRead);
|
||||||
|
|
||||||
downloadPosition += bytesRead;
|
downloadPosition += bytesRead;
|
||||||
@ -237,7 +238,7 @@ namespace AaxDecrypter
|
|||||||
downloadedPiece.Set();
|
downloadedPiece.Set();
|
||||||
}
|
}
|
||||||
|
|
||||||
} while (downloadPosition < ContentLength && !IsCancelled);
|
} while (downloadPosition < ContentLength && !IsCancelled && bytesRead > 0);
|
||||||
|
|
||||||
_writeFile.Close();
|
_writeFile.Close();
|
||||||
_networkStream.Close();
|
_networkStream.Close();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user