From 754e23a2f29320adaed29bcce7b9051d5f1987e0 Mon Sep 17 00:00:00 2001 From: e <511455842@qq.com> Date: Mon, 29 Jan 2018 21:19:06 +0800 Subject: [PATCH] fix bug https://github.com/AriaLyy/Aria/issues/192 --- .../arialyy/aria/core/common/AbsFileer.java | 39 +++++++------------ .../aria/core/common/StateConstance.java | 2 +- 2 files changed, 14 insertions(+), 27 deletions(-) diff --git a/Aria/src/main/java/com/arialyy/aria/core/common/AbsFileer.java b/Aria/src/main/java/com/arialyy/aria/core/common/AbsFileer.java index 01d2fb9f..54690796 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/common/AbsFileer.java +++ b/Aria/src/main/java/com/arialyy/aria/core/common/AbsFileer.java @@ -63,7 +63,6 @@ public abstract class AbsFileer= 0) { Long r = Long.parseLong(record + ""); - if (r > startL) { + //记录的位置需要在线程区间中 + if (startL < r && r < (i == (mTotalThreadNum - 1) ? fileLength : endL)) { mConstance.CURRENT_LOCATION += r - startL; startL = r; } - ALog.d(TAG, "任务【" + mEntity.getFileName() + "】线程__" + i + "__恢复"); + ALog.d(TAG, "任务【" + mEntity.getFileName() + "】线程__" + i + "__恢复下载"); recordL[rl] = i; rl++; } else { @@ -380,7 +367,7 @@ public abstract class AbsFileer 0) { @@ -405,7 +392,7 @@ public abstract class AbsFileer config = new SubThreadConfig<>(); diff --git a/Aria/src/main/java/com/arialyy/aria/core/common/StateConstance.java b/Aria/src/main/java/com/arialyy/aria/core/common/StateConstance.java index 386c55f0..e42e3f86 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/common/StateConstance.java +++ b/Aria/src/main/java/com/arialyy/aria/core/common/StateConstance.java @@ -63,7 +63,7 @@ public class StateConstance { * 所有子线程是否都已经完成下载 */ public boolean isComplete() { - return COMPLETE_THREAD_NUM == THREAD_NUM; + return COMPLETE_THREAD_NUM >= THREAD_NUM; } /**