Don’t process a download if the downloader was aborted.
authorDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 5 Mar 2014 05:46:02 +0000 (06:46 +0100)
committerDavid ‘Bombe’ Roden <bombe@pterodactylus.net>
Wed, 5 Mar 2014 05:46:02 +0000 (06:46 +0100)
src/main/java/net/pterodactylus/sone/core/SoneDownloader.java

index eb263ed..a406f1b 100644 (file)
@@ -17,6 +17,7 @@
 
 package net.pterodactylus.sone.core;
 
+import static java.util.logging.Level.FINER;
 import static net.pterodactylus.sone.data.Sone.TO_FREENET_URI;
 
 import java.io.InputStream;
@@ -148,6 +149,10 @@ public class SoneDownloader extends AbstractService {
                                /* TODO - mark Sone as bad. */
                                return null;
                        }
+                       if (shouldStop()) {
+                               logger.log(FINER, "Sone was stopped, won’t process download.");
+                               return null;
+                       }
                        logger.log(Level.FINEST, String.format("Got %d bytes back.", fetchResults.getFetchResult().size()));
                        Sone parsedSone = parseSone(sone, fetchResults.getFetchResult(), fetchResults.getFreenetUri());
                        if (parsedSone != null) {