lingochamp / FileDownloader

Multitask、MultiThread(MultiConnection)、Breakpoint-resume、High-concurrency、Simple to use、Single/NotSingle-process
Apache License 2.0
10.98k stars 2.18k forks source link

下载中重启后再开始下载时从头开始下载 #1063

Open mattermon opened 6 years ago

mattermon commented 6 years ago

app本身是个Service,没有Activity。在Service中执行下载,在下载过程中拉取/data/user/0/com.my.app/databases/中的数据,查看数据库,filedownloader表中sofar字段的值不变,所以怀疑下载进度没有写入到数据库。在pending中打印sofar的值,发现和数据库中的值不一样,这点比较困惑。pending回调中sofar有值,但下载时progress回调还是从0开始,这是什么原因?

mattermon commented 6 years ago

D/FileDownloader.DownloadTask: setPath /data/ota_package/update.zip D/FileDownloader.DownloadTask: setListener com.dservice.download.DownloadProcessor$2@cf4e559 V/FileDownloader.DownloadTaskHunter: call start Url[http://data.store.secice.com/update.zip], Path[/data/ota_package/update.zip] Listener[com.dservice.download.DownloadProcessor$2@cf4e559], Tag[null] V/FileDownloader.DownloadTaskHunter: the task[50617877] has been into the launch pool. V/FileDownloader.FileDownloadEventPool: setListener event.service.connect.changed I/FileDownloader.FileDownloadProperties: init properties 2 .non-separate=FALSE; download.min-progress-step=65536; download.min-progress-time=2000; download.max-network-thread-count=3; file.non-pre-allocation=FALSE; broadcast.completed=FALSE; download.trial-connection-head-method=FALSE D/FileDownloader.LostServiceConnectedHandler: Waiting for connecting with the downloader service... 50617877 D/FileDownloader.FileDownloadServiceUIGuard: bindStartByContext OTAApp D/FileDownloader.DownloadTaskHunter: free the task 50617877, when the status is 10 D/FileDownloader.FileDownloadServiceUIGuard: onServiceConnected ComponentInfo{com.dservice/com.liulishuo.filedownloader.services.FileDownloadService$SeparateProcessService} com.liulishuo.filedownloader.i.IFileDownloadIPCService$Stub$Proxy@43eb8b8 V/FileDownloader.FileDownloadEventPool: asyncPublishInNewThread event.service.connect.changed V/FileDownloader.FileDownloadEventPool: publish event.service.connect.changed D/FileDownloader.LostServiceConnectedHandler: The downloader service is connected. V/FileDownloader.DownloadTaskHunter: call start Url[http://data.store.secice.com/update.zip], Path[/data/ota_package/update.zip] Listener[com.dservice.download.DownloadProcessor$2@cf4e559], Tag[null] V/FileDownloader.DownloadTaskHunter: the task[50617877] has been into the launch pool. D/FileDownloader.FileDownloadMessenger: notify begin 50617877@com.liulishuo.filedownloader.DownloadTask@8dbe1f7 V/FileDownloader.DownloadTaskHunter: filedownloader:lifecycle:start com.liulishuo.filedownloader.DownloadTaskHunter@82a864 by 11 V/FileDownloader.FileDownloadList: add list in all 50617877@com.liulishuo.filedownloader.DownloadTask@8dbe1f7 11 1 D/FileDownloader.MessageSnapshotGate: ~~~callback 50617877 old[11] new[1] 1 D/FileDownloader.FileDownloadMessenger: notify pending 50617877@com.liulishuo.filedownloader.DownloadTask@8dbe1f7 D/FileDownloader.MessageSnapshotGate: updateKeepFlow D/FileDownloader.MessageSnapshotGate: ~~~callback 50617877 old[1] new[6] 1 D/FileDownloader.FileDownloadMessenger: notify started 50617877@com.liulishuo.filedownloader.DownloadTask@8dbe1f7 D/FileDownloader.MessageSnapshotGate: updateKeepFlow D/DService: download pending [soFarBytes:357619755 totalBytes:778895555] D/FileDownloader.MessageSnapshotGate: ~~~callback 50617877 old[6] new[2] 1 D/FileDownloader.FileDownloadMessenger: notify connected 50617877@com.liulishuo.filedownloader.DownloadTask@8dbe1f7 D/FileDownloader.MessageSnapshotGate: updateKeepFlow D/DService: download connected [etag:"5b235a31-2e6d00c3" isContinue:false soFarBytes:357619755 totalBytes:778895555] D/FileDownloader.MessageSnapshotGate: ~~~callback 50617877 old[2] new[3] 1 D/FileDownloader.FileDownloadMessenger: notify progress 50617877@com.liulishuo.filedownloader.DownloadTask@8dbe1f7 8041 778895555 D/FileDownloader.MessageSnapshotGate: updateKeepFlow D/DService: download progress [soFarBytes:8041 totalBytes778895555]

rantianhua commented 6 years ago

有可能是 Etag 不匹配导致断点失败,也有可能是 http response 201 导致断点失败。不过具体得看 filedownloader 进程的日志,希望你提供一份。