From 5bddfc10e99f70f2dfc3cd2bc95da8470b3f1758 Mon Sep 17 00:00:00 2001 From: Zlatin Balevsky Date: Mon, 12 Oct 2020 14:54:55 +0100 Subject: [PATCH] assume all persisted sources were successful --- .../main/groovy/com/muwire/core/download/DownloadManager.groovy | 2 ++ core/src/main/groovy/com/muwire/core/download/Downloader.groovy | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/core/src/main/groovy/com/muwire/core/download/DownloadManager.groovy b/core/src/main/groovy/com/muwire/core/download/DownloadManager.groovy index 8180197b..c928caa5 100644 --- a/core/src/main/groovy/com/muwire/core/download/DownloadManager.groovy +++ b/core/src/main/groovy/com/muwire/core/download/DownloadManager.groovy @@ -172,6 +172,8 @@ public class DownloadManager { if (json.paused != null) downloader.paused = json.paused + downloader.successfulDestinations.addAll(destinations) // if it was persisted, it was successful + try { downloader.readPieces() if (!downloader.paused) diff --git a/core/src/main/groovy/com/muwire/core/download/Downloader.groovy b/core/src/main/groovy/com/muwire/core/download/Downloader.groovy index 16246f17..ef423c7f 100644 --- a/core/src/main/groovy/com/muwire/core/download/Downloader.groovy +++ b/core/src/main/groovy/com/muwire/core/download/Downloader.groovy @@ -59,7 +59,7 @@ public class Downloader { private final File incompleteFile final int pieceSizePow2 private final Map activeWorkers = new ConcurrentHashMap<>() - private final Set successfulDestinations = new ConcurrentHashSet<>() + final Set successfulDestinations = new ConcurrentHashSet<>() /** LOCKING: itself */ private final Map failingDestinations = new HashMap<>() private final int maxFailures