Update DownloadRunnable.java

add description
This commit is contained in:
kapodamy 2019-10-01 13:09:26 -03:00 committed by GitHub
parent ecb4bfde0b
commit b1d89175fc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 0 deletions

View File

@ -117,6 +117,8 @@ public class DownloadRunnable extends Thread {
byte[] buf = new byte[DownloadMission.BUFFER_SIZE];
int len;
// use alwways start <= end
// fixes a deadlock in DownloadRunnable because youtube is sending one byte alone after downloading 26MiB exactly
while (start <= end && mMission.running && (len = is.read(buf, 0, buf.length)) != -1) {
f.write(buf, 0, len);
start += len;