Compare commits

..

2 Commits

Author SHA1 Message Date
Zlatin Balevsky
bd21cf65ea Release 0.1.5 2019-06-09 20:37:39 +01:00
Zlatin Balevsky
dea592eb27 do not resume cancelled downloads on restart 2019-06-09 20:36:14 +01:00
7 changed files with 20 additions and 4 deletions

View File

@@ -34,7 +34,7 @@ class Cli {
Core core
try {
core = new Core(props, home, "0.1.4")
core = new Core(props, home, "0.1.5")
} catch (Exception bad) {
bad.printStackTrace(System.out)
println "Failed to initialize core, exiting"

View File

@@ -53,7 +53,7 @@ class CliDownloader {
Core core
try {
core = new Core(props, home, "0.1.4")
core = new Core(props, home, "0.1.5")
} catch (Exception bad) {
bad.printStackTrace(System.out)
println "Failed to initialize core, exiting"

View File

@@ -12,6 +12,7 @@ import com.muwire.core.connection.I2PConnector
import com.muwire.core.connection.LeafConnectionManager
import com.muwire.core.connection.UltrapeerConnectionManager
import com.muwire.core.download.DownloadManager
import com.muwire.core.download.UIDownloadCancelledEvent
import com.muwire.core.download.UIDownloadEvent
import com.muwire.core.files.FileDownloadedEvent
import com.muwire.core.files.FileHashedEvent
@@ -195,6 +196,7 @@ public class Core {
eventBus.register(UIDownloadEvent.class, downloadManager)
eventBus.register(UILoadedEvent.class, downloadManager)
eventBus.register(FileDownloadedEvent.class, downloadManager)
eventBus.register(UIDownloadCancelledEvent.class, downloadManager)
log.info("initializing upload manager")
UploadManager uploadManager = new UploadManager(eventBus, fileManager)
@@ -255,7 +257,7 @@ public class Core {
}
}
Core core = new Core(props, home, "0.1.4")
Core core = new Core(props, home, "0.1.5")
core.startServices()
// ... at the end, sleep or execute script

View File

@@ -68,6 +68,11 @@ public class DownloadManager {
eventBus.publish(new DownloadStartedEvent(downloader : downloader))
}
public void onUIDownloadCancelledEvent(UIDownloadCancelledEvent e) {
downloaders.remove(e.downloader)
persistDownloaders()
}
void resume(Downloader downloader) {
executor.execute({downloader.download() as Runnable})
}

View File

@@ -0,0 +1,7 @@
package com.muwire.core.download
import com.muwire.core.Event
class UIDownloadCancelledEvent extends Event {
Downloader downloader
}

View File

@@ -1,5 +1,5 @@
group = com.muwire
version = 0.1.4
version = 0.1.5
groovyVersion = 2.4.15
slf4jVersion = 1.7.25
spockVersion = 1.1-groovy-2.4

View File

@@ -15,6 +15,7 @@ import javax.inject.Inject
import com.muwire.core.Constants
import com.muwire.core.Core
import com.muwire.core.download.DownloadStartedEvent
import com.muwire.core.download.UIDownloadCancelledEvent
import com.muwire.core.download.UIDownloadEvent
import com.muwire.core.search.QueryEvent
import com.muwire.core.search.SearchEvent
@@ -133,6 +134,7 @@ class MainFrameController {
void cancel() {
def downloader = model.downloads[selectedDownload()].downloader
downloader.cancel()
core.eventBus.publish(new UIDownloadCancelledEvent(downloader : downloader))
}
@ControllerAction