修复ftp服务器无法响应abor命令导致的无法停止上传的问题

修复ftp上传时,服务器有长度为0的文件导致上传失败的问题
修复下载任务和上传任务的文件路径是同一个时,导致的记录混乱问题
This commit is contained in:
laoyuyu
2019-12-17 22:04:21 +08:00
parent 0d93953cd9
commit 27c889e171
43 changed files with 295 additions and 145 deletions

View File

@@ -277,7 +277,7 @@ public class HttpFileInfoThread implements Runnable {
}
mEntity.setFileName(newName);
mEntity.setFilePath(newPath);
RecordUtil.modifyTaskRecord(oldFile.getPath(), newPath);
RecordUtil.modifyTaskRecord(oldFile.getPath(), newPath, mEntity.getTaskType());
}
/**

View File

@@ -67,7 +67,7 @@ public class HttpRecordAdapter extends AbsRecordHandlerAdapter {
tr.startLocation = startL;
tr.isComplete = false;
tr.threadType = TaskRecord.TYPE_HTTP_FTP;
tr.threadType = getEntity().getTaskType();
//最后一个线程的结束位置即为文件的总长度
if (threadId == (record.threadNum - 1)) {
endL = getEntity().getFileSize();
@@ -91,7 +91,7 @@ public class HttpRecordAdapter extends AbsRecordHandlerAdapter {
} else {
record.isBlock = false;
}
record.taskType = TaskRecord.TYPE_HTTP_FTP;
record.taskType = getEntity().getTaskType();
record.isGroupRecord = getEntity().isGroupChild();
if (record.isGroupRecord) {
if (getEntity() instanceof DownloadEntity) {

View File

@@ -112,7 +112,9 @@ final class HttpDThreadTaskAdapter extends BaseHttpThreadTaskAdapter {
new BufferedRandomAccessFile(getThreadConfig().tempFile, "rwd",
getTaskConfig().getBuffSize());
//设置每条线程写入文件的位置
file.seek(getThreadRecord().startLocation);
if (getThreadRecord().startLocation > 0){
file.seek(getThreadRecord().startLocation);
}
readNormal(is, file);
handleComplete();
}