X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fcore%2FSoneDownloaderImpl.java;h=c50c852a476a39e79dc858565a15ab6a8bd7d0d2;hb=e7550501ed1b8bcb07206a0fb76f07a52c300c6d;hp=8470e49dffe0dea36aefbd977de7e0758a5005a6;hpb=c8b9bb56bd7a73e39565fd577e14f8d5e1215c5d;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/core/SoneDownloaderImpl.java b/src/main/java/net/pterodactylus/sone/core/SoneDownloaderImpl.java index 8470e49..c50c852 100644 --- a/src/main/java/net/pterodactylus/sone/core/SoneDownloaderImpl.java +++ b/src/main/java/net/pterodactylus/sone/core/SoneDownloaderImpl.java @@ -31,7 +31,6 @@ import java.util.logging.Logger; import javax.inject.Inject; -import net.pterodactylus.sone.core.FreenetInterface.Fetched; import net.pterodactylus.sone.data.Sone; import net.pterodactylus.sone.data.Sone.SoneStatus; import net.pterodactylus.util.service.AbstractService; @@ -44,8 +43,6 @@ import freenet.keys.USK; import freenet.node.RequestStarter; import freenet.support.api.Bucket; -import com.google.common.annotations.VisibleForTesting; - /** * The Sone downloader is responsible for download Sones as they are updated. * @@ -76,22 +73,9 @@ public class SoneDownloaderImpl extends AbstractService implements SoneDownloade * The core * @param freenetInterface * The Freenet interface - */ - @Inject - public SoneDownloaderImpl(Core core, FreenetInterface freenetInterface) { - this(core, freenetInterface, new SoneParser(core)); - } - - /** - * Creates a new Sone downloader. - * - * @param core - * The core - * @param freenetInterface - * The Freenet interface * @param soneParser */ - @VisibleForTesting + @Inject SoneDownloaderImpl(Core core, FreenetInterface freenetInterface, SoneParser soneParser) { super("Sone Downloader", false); this.core = core; @@ -127,7 +111,7 @@ public class SoneDownloaderImpl extends AbstractService implements SoneDownloade sone, key, newKnownGood, newSlotToo)); if (edition > sone.getLatestEdition()) { sone.setLatestEdition(edition); - new Thread(fetchSoneAction(sone), + new Thread(fetchSoneAsSskAction(sone), "Sone Downloader").start(); } } @@ -155,7 +139,7 @@ public class SoneDownloaderImpl extends AbstractService implements SoneDownloade return (currentTimeMillis() - sone.getTime()) < DAYS.toMillis(7); } - private void fetchSone(Sone sone) { + private void fetchSoneAsSsk(Sone sone) { fetchSone(sone, sone.getRequestUri().sskForUSK(), false); } @@ -231,7 +215,7 @@ public class SoneDownloaderImpl extends AbstractService implements SoneDownloade } @Override - public Runnable fetchSoneWithUriAction(final Sone sone) { + public Runnable fetchSoneAsUskAction(final Sone sone) { return new Runnable() { @Override public void run() { @@ -241,11 +225,11 @@ public class SoneDownloaderImpl extends AbstractService implements SoneDownloade } @Override - public Runnable fetchSoneAction(final Sone sone) { + public Runnable fetchSoneAsSskAction(final Sone sone) { return new Runnable() { @Override public void run() { - fetchSone(sone); + fetchSoneAsSsk(sone); } }; }