X-Git-Url: https://git.pterodactylus.net/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fcore%2FFreenetInterface.java;h=946371bcf3b3c6a91e4c43823fad254dadaeb1a0;hb=3b711e4ff7898c71778dd3a8695ee3e0e3542861;hp=4b33139a4862d1d99e52f88f3302a2f7dab033ba;hpb=f814ad7a876bea03db77b30532eab3e7e03a05d8;p=Sone.git diff --git a/src/main/java/net/pterodactylus/sone/core/FreenetInterface.java b/src/main/java/net/pterodactylus/sone/core/FreenetInterface.java index 4b33139..946371b 100644 --- a/src/main/java/net/pterodactylus/sone/core/FreenetInterface.java +++ b/src/main/java/net/pterodactylus/sone/core/FreenetInterface.java @@ -178,7 +178,7 @@ public class FreenetInterface { @Override public boolean snoopMetadata(Metadata meta, ClientContext context) { String mimeType = meta.getMIMEType(); - boolean cancel = (mimeType == null) || backgroundFetchCallback.cancelForMimeType(uri, mimeType); + boolean cancel = (mimeType == null) || backgroundFetchCallback.shouldCancel(uri, mimeType, meta.dataLength()); if (cancel) { backgroundFetchCallback.failed(uri); } @@ -196,7 +196,7 @@ public class FreenetInterface { } public interface BackgroundFetchCallback { - boolean cancelForMimeType(@Nonnull FreenetURI uri, @Nonnull String mimeType); + boolean shouldCancel(@Nonnull FreenetURI uri, @Nonnull String mimeType, long size); void loaded(@Nonnull FreenetURI uri, @Nonnull String mimeType, @Nonnull byte[] data); void failed(@Nonnull FreenetURI uri); }