From bf9df3fc7e82bee703f72330cf9fc3e175d1582a Mon Sep 17 00:00:00 2001 From: Joey Hess Date: Wed, 17 Dec 2014 14:21:48 -0400 Subject: [PATCH] fix fencepost error and aria resume after partial download of multi-file torrent --- Remote/BitTorrent.hs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Remote/BitTorrent.hs b/Remote/BitTorrent.hs index d4c2792cc2..fcb53420e9 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 ()