Exit download loop if zero bytes are read.
This commit is contained in:
parent
f8f5eac109
commit
984119c7ee
1 changed files with 3 additions and 2 deletions
|
|
@ -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…
Add table
Add a link
Reference in a new issue