Author: toad
Date: 2006-05-26 19:30:28 +0000 (Fri, 26 May 2006)
New Revision: 8878

Modified:
   trunk/freenet/src/freenet/client/async/SimpleManifestPutter.java
   trunk/freenet/src/freenet/node/Version.java
Log:
743: Quick hack to prevent insertion of containers which are so big that they 
can't be fetched.

Modified: trunk/freenet/src/freenet/client/async/SimpleManifestPutter.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SimpleManifestPutter.java    
2006-05-26 17:07:55 UTC (rev 8877)
+++ trunk/freenet/src/freenet/client/async/SimpleManifestPutter.java    
2006-05-26 19:30:28 UTC (rev 8878)
@@ -197,6 +197,7 @@
        private boolean hasResolvedBase = false;
        private final static String[] defaultDefaultNames =
                new String[] { "index.html", "index.htm", "default.html", 
"default.htm" };
+       private int bytesOnZip = 0;
        private LinkedList elementsToPutInZip;

        public SimpleManifestPutter(ClientCallback cb, ClientRequestScheduler 
chkSched,
@@ -277,7 +278,10 @@
                                        // Decide whether to put it in the ZIP.
                                        // FIXME support multiple ZIPs and size 
limits.
                                        // FIXME support better heuristics.
-                                       if(data.size() <= 65536) { // totally 
dumb heuristic!
+                                       int sz = (int)data.size() + 40 + 
element.fullName.length();
+                                       if(data.size() <= 65536 && 
+                                                       bytesOnZip + sz < 
((2048-64)*1024)) { // totally dumb heuristic!
+                                               bytesOnZip += sz;
                                                // Put it in the zip.
                                                ph = new PutHandler(name, 
ZipPrefix+element.fullName, cm, data);
                                                elementsToPutInZip.addLast(ph);

Modified: trunk/freenet/src/freenet/node/Version.java
===================================================================
--- trunk/freenet/src/freenet/node/Version.java 2006-05-26 17:07:55 UTC (rev 
8877)
+++ trunk/freenet/src/freenet/node/Version.java 2006-05-26 19:30:28 UTC (rev 
8878)
@@ -18,7 +18,7 @@
        public static final String protocolVersion = "1.0";

        /** The build number of the current revision */
-       private static final int buildNumber = 742;
+       private static final int buildNumber = 743;

        /** Oldest build of Fred we will talk to */
        private static final int lastGoodBuild = 732;


Reply via email to