long-term downloads resume
* recovery infrastructure * bump serialVersionUID of DownloadMission * misc cleanup in DownloadMission.java * remove unused/redundant from strings.xml
This commit is contained in:
parent
dab53450c1
commit
86dafdd92b
42 changed files with 478 additions and 97 deletions
|
|
@ -1,6 +1,7 @@
|
|||
package us.shandian.giga.get;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
|
||||
import org.schabi.newpipe.streams.io.SharpStream;
|
||||
|
|
@ -151,6 +152,20 @@ public class DownloadInitializer extends Thread {
|
|||
|
||||
if (!mMission.running || Thread.interrupted()) return;
|
||||
|
||||
if (!mMission.unknownLength && mMission.recoveryInfo != null) {
|
||||
String entityTag = mConn.getHeaderField("ETAG");
|
||||
String lastModified = mConn.getHeaderField("Last-Modified");
|
||||
MissionRecoveryInfo recovery = mMission.recoveryInfo[mMission.current];
|
||||
|
||||
if (!TextUtils.isEmpty(entityTag)) {
|
||||
recovery.validateCondition = entityTag;
|
||||
} else if (!TextUtils.isEmpty(lastModified)) {
|
||||
recovery.validateCondition = lastModified;// Note: this is less precise
|
||||
} else {
|
||||
recovery.validateCondition = null;
|
||||
}
|
||||
}
|
||||
|
||||
mMission.running = false;
|
||||
break;
|
||||
} catch (InterruptedIOException | ClosedByInterruptException e) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue