summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Joey Hess <joeyh@joeyh.name>2014-12-17 14:38:04 -0400
committerGravatar Joey Hess <joeyh@joeyh.name>2014-12-17 14:38:04 -0400
commit3a6ef17937b60245271476aae13f1d74a27285c1 (patch)
tree64ea10dd93d9704274770ac6cd13ca1e3c0c9778
parente3364b0ad0df0d5ea9129f91d161bbd3d145a063 (diff)
more robust fallback when a file is available from multiple torrents and some torrent files cannot be downloaded
-rw-r--r--Remote/BitTorrent.hs9
1 files changed, 5 insertions, 4 deletions
diff --git a/Remote/BitTorrent.hs b/Remote/BitTorrent.hs
index fcb53420e..c1190a562 100644
--- a/Remote/BitTorrent.hs
+++ b/Remote/BitTorrent.hs
@@ -77,16 +77,17 @@ downloadKey key _file dest p = do
get . map (torrentUrlNum . fst . getDownloader) =<< getBitTorrentUrls key
where
get [] = do
- warning "no known torrent url"
+ warning "could not download torrent"
return False
get urls = do
showOutput -- make way for download progress bar
untilTrue urls $ \(u, filenum) -> do
registerTorrentCleanup u
checkDependencies
- unlessM (downloadTorrentFile u) $
- error "could not download torrent file"
- downloadTorrentContent key u dest filenum p
+ ifM (downloadTorrentFile u)
+ ( downloadTorrentContent key u dest filenum p
+ , return False
+ )
downloadKeyCheap :: Key -> FilePath -> Annex Bool
downloadKeyCheap _ _ = return False