X-Git-Url: https://git.pterodactylus.net/?p=Sone.git;a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fnet%2Fpterodactylus%2Fsone%2Fcore%2FFreenetInterface.java;h=946371bcf3b3c6a91e4c43823fad254dadaeb1a0;hp=82cc94b2f28a80ed6f1038e7cb2482a01d672e6e;hb=ffd92ca2374c0b2218e583d02e0bdd24b8c110ae;hpb=1cd71a1c2a94f889d63d6ec3168d76da0a8b116b diff --git a/src/main/java/net/pterodactylus/sone/core/FreenetInterface.java b/src/main/java/net/pterodactylus/sone/core/FreenetInterface.java index 82cc94b..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); } @@ -187,7 +187,7 @@ public class FreenetInterface { }; FetchContext fetchContext = client.getFetchContext(); try { - ClientGetter clientGetter = client.fetch(uri, 1048576, callback, fetchContext, RequestStarter.INTERACTIVE_PRIORITY_CLASS); + ClientGetter clientGetter = client.fetch(uri, 2097152, callback, fetchContext, RequestStarter.INTERACTIVE_PRIORITY_CLASS); clientGetter.setMetaSnoop(snoop); clientGetter.restart(uri, fetchContext.filterData, node.clientCore.clientContext); } catch (FetchException fe) { @@ -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); }