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 abafc0cb..dca44fa1 100644 --- a/core/src/main/groovy/com/muwire/core/download/Downloader.groovy +++ b/core/src/main/groovy/com/muwire/core/download/Downloader.groovy @@ -156,7 +156,13 @@ public class Downloader { } public void resume() { - downloadManager.resume(this) + activeWorkers.each { destination, worker -> + if (worker.currentState == WorkerState.FINISHED) { + def newWorker = new DownloadWorker(destination) + activeWorkers.put(destination, newWorker) + executorService.submit(newWorker) + } + } } class DownloadWorker implements Runnable { diff --git a/gui/griffon-app/models/com/muwire/gui/MainFrameModel.groovy b/gui/griffon-app/models/com/muwire/gui/MainFrameModel.groovy index fbbde09e..be952689 100644 --- a/gui/griffon-app/models/com/muwire/gui/MainFrameModel.groovy +++ b/gui/griffon-app/models/com/muwire/gui/MainFrameModel.groovy @@ -110,7 +110,9 @@ class MainFrameModel { lastRetryTime = now runInsideUIAsync { downloads.each { - if (it.downloader.currentState == Downloader.DownloadState.FAILED) + def state = it.downloader.currentState + if (state == Downloader.DownloadState.FAILED || + state == Downloader.DownloadState.DOWNLOADING) it.downloader.resume() updateTablePreservingSelection("downloads-table") }