You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Build on #12's SQLite download progress tracking to make peer downloads resumable and robust across retries and Jack restarts.
Once Jack persists download state (expectedBytes, downloadedBytes, partPath, status, timestamps, and errors), failed or interrupted downloads should not have to restart from byte 0. Jack should use the persisted state plus the existing .part file to resume from the last durable byte whenever the peer still serves the same file.
Transient peer/network failures retry with bounded backoff.
Interrupted downloads resume from the existing .part file when the peer supports valid range requests.
If resume validation fails, Jack safely restarts from byte 0 and records that transition in progress state.
Failed downloads do not leave importable partial files in the completed folder.
Stale downloading rows and .part files from prior crashes are reconciled deliberately on startup.
Tests cover range serving, client resume, restart reconciliation, concurrency limiting, retry behavior, failed-download cleanup, and stale partial handling.
Summary
Build on #12's SQLite download progress tracking to make peer downloads resumable and robust across retries and Jack restarts.
Once Jack persists download state (
expectedBytes,downloadedBytes,partPath, status, timestamps, and errors), failed or interrupted downloads should not have to restart from byte 0. Jack should use the persisted state plus the existing.partfile to resume from the last durable byte whenever the peer still serves the same file.Proposed Scope
downloads, for examplemaxConcurrentDownloads.Retry-Afterfor 429 where possible.downloadingrows and existing*.partfiles.Required Resumability
Implement HTTP
Rangesupport between Jack peers.Serving side:
Accept-Ranges: byteson full-file responses.Range: bytes=<start>-<end>request headers.206 Partial ContentwithContent-Range: bytes start-end/totalfor valid ranges.416 Range Not Satisfiablefor invalid or unsatisfiable ranges.Client side:
.partfile size..partfile exists, sendRange: bytes=<existingSize>-.206with a matchingContent-Range.200, or the range metadata does not match the persisted expected size, discard/truncate the stale.partand restart from byte 0..partinto the completed path only after the expected total bytes are present.Acceptance Criteria
.torrentfiles cannot start unlimited simultaneous peer downloads..partfile when the peer supports valid range requests.downloadingrows and.partfiles from prior crashes are reconciled deliberately on startup.