summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2014-12-17 14:21:48 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2014-12-17 14:21:48 -0400
commitda23cebe35d288aa7a79a841708bdbee784db12a (patch)
treec036e4b16e8321020d6e0fc5c5cdfc86c2c5fc58
parent54e29183d92006e2a2bfb83653ef7dea1e610679 (diff)
fix fencepost error and aria resume after partial download of multi-file torrent
-rw-r--r--Remote/BitTorrent.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/Remote/BitTorrent.hs b/Remote/BitTorrent.hs
index d4c2792cc..fcb53420e 100644
--- a/Remote/BitTorrent.hs
+++ b/Remote/BitTorrent.hs
@@ -255,6 +255,9 @@ downloadTorrentContent k u dest filenum p = do
, Param "--seed-time=0"
, Param "--summary-interval=0"
, Param "--file-allocation=none"
+ -- Needed so aria will resume partially downloaded files
+ -- in multi-file torrents.
+ , Param "--check-integrity=true"
]
{- aria2c will create part of the directory structure
@@ -265,7 +268,7 @@ downloadTorrentContent k u dest filenum p = do
wantedfile torrent = do
fs <- liftIO $ map fst <$> torrentFileSizes torrent
if length fs >= filenum
- then return (fs !! filenum)
+ then return (fs !! (filenum - 1))
else error "Number of files in torrent seems to have changed."
checkDependencies :: Annex ()