修复wait模式下,resume(true)无效问题
This commit is contained in:
laoyuyu
2020-02-22 13:08:41 +08:00
parent ea2e27f3e9
commit d92f1bba94
14 changed files with 54 additions and 22 deletions

View File

@@ -130,13 +130,17 @@ public class RecordHelper {
/*
* 检查记录文件
*/
if (blockFileLen == threadRect) {
if (blockFileLen == threadRect && blockFileLen != 0) {
ALog.i(TAG, String.format("分块【%s】已完成更新记录", temp.getPath()));
tr.startLocation = blockFileLen;
tr.isComplete = true;
} else if (tr.startLocation != realLocation) { // 处理记录小于分块文件长度的情况
ALog.i(TAG, String.format("修正分块【%s】的进度记录为%s", temp.getPath(), realLocation));
tr.startLocation = realLocation;
}else {
ALog.i(TAG, String.format("修正分块【%s】的进度记录为%s", temp.getPath(), realLocation));
tr.startLocation = realLocation;
tr.isComplete = false;
}
} else {
ALog.i(TAG, String.format("分块【%s】已完成", temp.getPath()));

View File

@@ -28,6 +28,7 @@ import com.arialyy.aria.core.manager.ThreadTaskManager;
import com.arialyy.aria.core.task.IThreadTask;
import com.arialyy.aria.core.wrapper.AbsTaskWrapper;
import com.arialyy.aria.exception.AriaException;
import com.arialyy.aria.util.ALog;
import com.arialyy.aria.util.FileUtil;
import java.io.File;
@@ -99,6 +100,9 @@ public class NormalLoader<T extends AbsTaskWrapper> extends AbsNormalLoader<T> {
}
protected void startThreadTask() {
if (isBreak()){
return;
}
if (getListener() instanceof IDLoadListener) {
((IDLoadListener) getListener()).onPostPre(getEntity().getFileSize());

View File

@@ -93,6 +93,10 @@ public final class SubLoader implements ILoader, ILoaderVisitor {
}
private void handlerTask() {
if (isBreak()){
return;
}
record = recordHandler.getRecord(wrapper.getEntity().getFileSize());
if (record.threadRecords != null
&& !TextUtils.isEmpty(record.filePath)