diff --git a/Aria/src/main/java/com/arialyy/aria/core/command/StartCmd.java b/Aria/src/main/java/com/arialyy/aria/core/command/StartCmd.java index f6b7cc2c..54fcdec0 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/command/StartCmd.java +++ b/Aria/src/main/java/com/arialyy/aria/core/command/StartCmd.java @@ -29,7 +29,7 @@ import com.arialyy.aria.util.NetUtils; */ final public class StartCmd extends AbsNormalCmd { - private boolean newStart = false; + private boolean nowStart = false; StartCmd(T entity, int taskType) { super(entity, taskType); @@ -38,10 +38,10 @@ final public class StartCmd extends AbsNormalCmd { /** * 立即执行任务 * - * @param newStart true 立即执行任务,无论执行队列是否满了 + * @param nowStart true 立即执行任务,无论执行队列是否满了 */ - public void setNewStart(boolean newStart) { - this.newStart = newStart; + public void setNowStart(boolean nowStart) { + this.nowStart = nowStart; } @Override public void executeCmd() { @@ -82,7 +82,7 @@ final public class StartCmd extends AbsNormalCmd { startTask(); } } else { - if (newStart) { + if (nowStart) { startTask(); } else { sendWaitState(task); @@ -92,7 +92,19 @@ final public class StartCmd extends AbsNormalCmd { } else { //任务没执行并且执行队列中没有该任务,才认为任务没有运行中 if (!mQueue.taskIsRunning(task.getKey())) { - resumeTask(); + if (mod.equals(QueueMod.NOW.getTag())) { + resumeTask(); + } else { + if (mQueue.getCurrentExePoolNum() < maxTaskNum) { + resumeTask(); + } else { + if (nowStart) { + resumeTask(); + } else { + sendWaitState(task); + } + } + } } else { ALog.w(TAG, String.format("任务【%s】已经在运行", task.getTaskName())); } diff --git a/Aria/src/main/java/com/arialyy/aria/core/common/controller/NormalController.java b/Aria/src/main/java/com/arialyy/aria/core/common/controller/NormalController.java index f1c18a22..3a5a6cd8 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/common/controller/NormalController.java +++ b/Aria/src/main/java/com/arialyy/aria/core/common/controller/NormalController.java @@ -66,7 +66,7 @@ public final class NormalController extends FeatureController implements INormal StartCmd cmd = (StartCmd) CmdHelper.createNormalCmd(getTaskWrapper(), NormalCmdFactory.TASK_START, checkTaskType()); - cmd.setNewStart(newStart); + cmd.setNowStart(newStart); EventMsgUtil.getDefault() .post(cmd); } diff --git a/Aria/src/main/java/com/arialyy/aria/core/queue/AbsTaskQueue.java b/Aria/src/main/java/com/arialyy/aria/core/queue/AbsTaskQueue.java index 749d2732..825744df 100644 --- a/Aria/src/main/java/com/arialyy/aria/core/queue/AbsTaskQueue.java +++ b/Aria/src/main/java/com/arialyy/aria/core/queue/AbsTaskQueue.java @@ -113,6 +113,10 @@ public abstract class AbsTaskQueue= getMaxTaskNum()) { task.getTaskWrapper().getEntity().setState(IEntity.STATE_WAIT); mCachePool.putTaskToFirst(task); diff --git a/DEV_LOG.md b/DEV_LOG.md index 44712ecc..86ef3d80 100644 --- a/DEV_LOG.md +++ b/DEV_LOG.md @@ -1,7 +1,9 @@ ## 开发日志 + v_3.8.7 - 修复组合任务单个子任务失败后,重新恢复组合任务,组合任务状态变为完成的问题 - + - 修复40x错误,会继续重试并且无法重试成功的问题 https://github.com/AriaLyy/Aria/issues/619 + - 修复wait模式下,resume(true)无效问题 + - 修复now模式下的一些问题 https://github.com/AriaLyy/Aria/issues/620 + v_3.8.6 (2020/2/17) - fix bug https://github.com/AriaLyy/Aria/issues/608 - fix bug https://github.com/AriaLyy/Aria/issues/579#issuecomment-586665035 diff --git a/FtpComponent/src/main/java/com/arialyy/aria/ftp/upload/FtpULoader.java b/FtpComponent/src/main/java/com/arialyy/aria/ftp/upload/FtpULoader.java index 07278e60..5b17677c 100644 --- a/FtpComponent/src/main/java/com/arialyy/aria/ftp/upload/FtpULoader.java +++ b/FtpComponent/src/main/java/com/arialyy/aria/ftp/upload/FtpULoader.java @@ -37,6 +37,9 @@ final class FtpULoader extends NormalLoader { @Override protected void startThreadTask() { + if (isBreak()) { + return; + } // 检查记录 ((FtpURecordHandler) mRecordHandler).setFtpFile(ftpFile); if (mRecordHandler.checkTaskCompleted()) { diff --git a/HttpComponent/src/main/java/com/arialyy/aria/http/HttpRecordHandler.java b/HttpComponent/src/main/java/com/arialyy/aria/http/HttpRecordHandler.java index c714a846..aa3d0dea 100644 --- a/HttpComponent/src/main/java/com/arialyy/aria/http/HttpRecordHandler.java +++ b/HttpComponent/src/main/java/com/arialyy/aria/http/HttpRecordHandler.java @@ -36,13 +36,6 @@ public final class HttpRecordHandler extends RecordHandler { super(wrapper); } - @Override public void onPre() { - super.onPre(); - //if (getWrapper().getRequestType() == ITaskWrapper.U_HTTP) { - // RecordUtil.delTaskRecord(getEntity().getFilePath(), IRecordHandler.TYPE_UPLOAD); - //} - } - @Override public void handlerTaskRecord(TaskRecord record) { RecordHelper helper = new RecordHelper(getWrapper(), record); if (getWrapper().isSupportBP() && record.threadNum > 1) { diff --git a/HttpComponent/src/main/java/com/arialyy/aria/http/download/HttpDThreadTaskAdapter.java b/HttpComponent/src/main/java/com/arialyy/aria/http/download/HttpDThreadTaskAdapter.java index 745a07b6..4ec147b4 100644 --- a/HttpComponent/src/main/java/com/arialyy/aria/http/download/HttpDThreadTaskAdapter.java +++ b/HttpComponent/src/main/java/com/arialyy/aria/http/download/HttpDThreadTaskAdapter.java @@ -43,7 +43,7 @@ import java.util.Set; * Created by lyy on 2017/1/18. 下载线程 */ final class HttpDThreadTaskAdapter extends BaseHttpThreadTaskAdapter { - private final String TAG = "HttpThreadTask"; + private final String TAG = "HttpDThreadTaskAdapter"; private DTaskWrapper mTaskWrapper; HttpDThreadTaskAdapter(SubThreadConfig config) { diff --git a/PublicComponent/src/main/java/com/arialyy/aria/core/common/RecordHelper.java b/PublicComponent/src/main/java/com/arialyy/aria/core/common/RecordHelper.java index 63b4200b..59adb0d8 100644 --- a/PublicComponent/src/main/java/com/arialyy/aria/core/common/RecordHelper.java +++ b/PublicComponent/src/main/java/com/arialyy/aria/core/common/RecordHelper.java @@ -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())); diff --git a/PublicComponent/src/main/java/com/arialyy/aria/core/loader/NormalLoader.java b/PublicComponent/src/main/java/com/arialyy/aria/core/loader/NormalLoader.java index 5d440860..f3a2b635 100644 --- a/PublicComponent/src/main/java/com/arialyy/aria/core/loader/NormalLoader.java +++ b/PublicComponent/src/main/java/com/arialyy/aria/core/loader/NormalLoader.java @@ -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 extends AbsNormalLoader { } protected void startThreadTask() { + if (isBreak()){ + return; + } if (getListener() instanceof IDLoadListener) { ((IDLoadListener) getListener()).onPostPre(getEntity().getFileSize()); diff --git a/PublicComponent/src/main/java/com/arialyy/aria/core/loader/SubLoader.java b/PublicComponent/src/main/java/com/arialyy/aria/core/loader/SubLoader.java index e98e3157..789ff3f5 100644 --- a/PublicComponent/src/main/java/com/arialyy/aria/core/loader/SubLoader.java +++ b/PublicComponent/src/main/java/com/arialyy/aria/core/loader/SubLoader.java @@ -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) diff --git a/SFtpComponent/src/main/java/com/arialyy/aria/sftp/download/SFtpDLoader.java b/SFtpComponent/src/main/java/com/arialyy/aria/sftp/download/SFtpDLoader.java index 2a3b68a3..3c497591 100644 --- a/SFtpComponent/src/main/java/com/arialyy/aria/sftp/download/SFtpDLoader.java +++ b/SFtpComponent/src/main/java/com/arialyy/aria/sftp/download/SFtpDLoader.java @@ -87,6 +87,9 @@ final class SFtpDLoader extends AbsNormalLoader { } private void startThreadTask() { + if (isBreak()) { + return; + } if (getListener() instanceof IDLoadListener) { ((IDLoadListener) getListener()).onPostPre(getEntity().getFileSize()); diff --git a/SFtpComponent/src/main/java/com/arialyy/aria/sftp/upload/SFtpULoader.java b/SFtpComponent/src/main/java/com/arialyy/aria/sftp/upload/SFtpULoader.java index 34cda951..0448ccb3 100644 --- a/SFtpComponent/src/main/java/com/arialyy/aria/sftp/upload/SFtpULoader.java +++ b/SFtpComponent/src/main/java/com/arialyy/aria/sftp/upload/SFtpULoader.java @@ -86,6 +86,9 @@ final class SFtpULoader extends AbsNormalLoader { } private void startThreadTask(SftpATTRS attrs) { + if (isBreak()) { + return; + } if (getListener() instanceof IDLoadListener) { ((IDLoadListener) getListener()).onPostPre(getEntity().getFileSize()); diff --git a/app/src/main/assets/aria_config.xml b/app/src/main/assets/aria_config.xml index 26626b21..4f373352 100644 --- a/app/src/main/assets/aria_config.xml +++ b/app/src/main/assets/aria_config.xml @@ -22,7 +22,7 @@ - + - + @@ -68,7 +68,7 @@ - + diff --git a/build.gradle b/build.gradle index d3a5f112..e1fcdec4 100644 --- a/build.gradle +++ b/build.gradle @@ -44,8 +44,8 @@ task clean(type: Delete) { } ext { - versionCode = 386 - versionName = '3.8.6' + versionCode = 387 + versionName = '3.8.7-beta-1' userOrg = 'arialyy' groupId = 'com.arialyy.aria' publishVersion = versionName