修复3.3.7_dev 任务组暂停没反应的问题 https://github.com/AriaLyy/Aria/issues/164

pull/330/head
AriaLyy 7 years ago
parent 32dfc03692
commit ed4c2c4b6f
  1. 7
      Aria/src/main/java/com/arialyy/aria/core/common/AbsFileer.java
  2. 13
      Aria/src/main/java/com/arialyy/aria/core/download/downloader/HttpThreadTask.java
  3. 2
      app/src/main/assets/aria_config.xml

@ -122,8 +122,11 @@ public abstract class AbsFileer<ENTITY extends AbsNormalEntity, TASK_ENTITY exte
* 设置新任务的最大线程数
*/
protected int getNewTaskThreadNum() {
return mEntity.getFileSize() <= SUB_LEN || mTaskEntity.requestType == AbsTaskEntity.D_FTP_DIR
? 1 : AriaManager.getInstance(mContext).getDownloadConfig().getThreadNum();
final int num =
mEntity.getFileSize() <= SUB_LEN || mTaskEntity.requestType == AbsTaskEntity.D_FTP_DIR ? 1
: AriaManager.getInstance(mContext).getDownloadConfig().getThreadNum();
mStartThreadNum = num;
return num;
}
/**

@ -80,13 +80,18 @@ final class HttpThreadTask extends AbsThreadTask<DownloadEntity, DownloadTaskEnt
byte[] buffer = new byte[mBufSize];
int len;
while ((len = is.read(buffer)) != -1) {
if (STATE.isCancel) break;
if (STATE.isStop) break;
if (mSleepTime > 0) Thread.sleep(mSleepTime);
if (STATE.isCancel || STATE.isStop){
break;
}
if (mSleepTime > 0) {
Thread.sleep(mSleepTime);
}
file.write(buffer, 0, len);
progress(len);
}
if (STATE.isCancel || STATE.isStop) return;
if (STATE.isCancel || STATE.isStop){
return;
}
//支持断点的处理
if (mConfig.SUPPORT_BP) {
ALog.i(TAG, "任务【" + mConfig.TEMP_FILE.getName() + "】线程__" + mConfig.THREAD_ID + "__下载完毕");

@ -8,7 +8,7 @@
<threadNum value="3"/>
<!--设置下载队列最大任务数, 默认为2-->
<maxTaskNum value="2"/>
<maxTaskNum value="1"/>
<!--设置下载失败,重试次数,默认为10-->
<reTryNum value="2"/>

Loading…
Cancel
Save