ftps 上传/下载优化,上传/下载速度限制实现
This commit is contained in:
@@ -17,6 +17,7 @@ package com.arialyy.aria.core;
|
||||
|
||||
import android.text.TextUtils;
|
||||
import com.arialyy.aria.core.common.QueueMod;
|
||||
import com.arialyy.aria.core.queue.DownloadGroupTaskQueue;
|
||||
import com.arialyy.aria.core.queue.DownloadTaskQueue;
|
||||
import com.arialyy.aria.core.queue.UploadTaskQueue;
|
||||
import com.arialyy.aria.util.ALog;
|
||||
@@ -247,6 +248,21 @@ class Configuration {
|
||||
*/
|
||||
int iOTimeOut = 20 * 1000;
|
||||
|
||||
/**
|
||||
* 设置最大下载/上传速度,单位:kb, 为0表示不限速
|
||||
*/
|
||||
int maxSpeed = 0;
|
||||
|
||||
public int getMaxSpeed() {
|
||||
return maxSpeed;
|
||||
}
|
||||
|
||||
public BaseTaskConfig setMaxSpeed(int maxSpeed) {
|
||||
this.maxSpeed = maxSpeed;
|
||||
saveKey("maxSpeed", String.valueOf(maxSpeed));
|
||||
return this;
|
||||
}
|
||||
|
||||
public long getUpdateInterval() {
|
||||
return updateInterval;
|
||||
}
|
||||
@@ -374,11 +390,6 @@ class Configuration {
|
||||
*/
|
||||
int threadNum = 3;
|
||||
|
||||
/**
|
||||
* 设置最大下载速度,单位:kb, 为0表示不限速
|
||||
*/
|
||||
int maxSpeed = 0;
|
||||
|
||||
/**
|
||||
* 多线程下载是否使用块下载模式,{@code true}使用,{@code false}不使用
|
||||
* 注意:
|
||||
@@ -393,6 +404,13 @@ class Configuration {
|
||||
return useBlock;
|
||||
}
|
||||
|
||||
@Override public DownloadConfig setMaxSpeed(int maxSpeed) {
|
||||
super.setMaxSpeed(maxSpeed);
|
||||
DownloadTaskQueue.getInstance().setMaxSpeed(maxSpeed);
|
||||
DownloadGroupTaskQueue.getInstance().setMaxSpeed(maxSpeed);
|
||||
return this;
|
||||
}
|
||||
|
||||
public DownloadConfig setUseBlock(boolean useBlock) {
|
||||
this.useBlock = useBlock;
|
||||
saveKey("useBlock", String.valueOf(useBlock));
|
||||
@@ -407,17 +425,6 @@ class Configuration {
|
||||
return this;
|
||||
}
|
||||
|
||||
public int getMaxSpeed() {
|
||||
return maxSpeed;
|
||||
}
|
||||
|
||||
public DownloadConfig setMaxSpeed(int maxSpeed) {
|
||||
this.maxSpeed = maxSpeed;
|
||||
saveKey("maxSpeed", String.valueOf(maxSpeed));
|
||||
DownloadTaskQueue.getInstance().setMaxSpeed(maxSpeed);
|
||||
return this;
|
||||
}
|
||||
|
||||
public DownloadConfig setThreadNum(int threadNum) {
|
||||
this.threadNum = threadNum;
|
||||
saveKey("threadNum", String.valueOf(threadNum));
|
||||
@@ -478,6 +485,12 @@ class Configuration {
|
||||
loadConfig();
|
||||
}
|
||||
|
||||
@Override public UploadConfig setMaxSpeed(int maxSpeed) {
|
||||
super.setMaxSpeed(maxSpeed);
|
||||
UploadTaskQueue.getInstance().setMaxSpeed(maxSpeed);
|
||||
return this;
|
||||
}
|
||||
|
||||
public UploadConfig setMaxTaskNum(int maxTaskNum) {
|
||||
oldMaxTaskNum = this.maxTaskNum;
|
||||
this.maxTaskNum = maxTaskNum;
|
||||
|
||||
@@ -29,7 +29,6 @@ import com.arialyy.aria.util.ALog;
|
||||
public class UploadTask extends AbsNormalTask<UploadTaskEntity> {
|
||||
private static final String TAG = "UploadTask";
|
||||
|
||||
private SimpleUploadUtil mUtil;
|
||||
private BaseUListener<UploadEntity, UploadTaskEntity, UploadTask> mListener;
|
||||
|
||||
private UploadTask(UploadTaskEntity taskEntity, Handler outHandler) {
|
||||
|
||||
Reference in New Issue
Block a user