Author: nextgens
Date: 2008-08-17 12:30:39 +0000 (Sun, 17 Aug 2008)
New Revision: 21959

Modified:
   trunk/freenet/src/freenet/client/ArchiveManager.java
   trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
   trunk/freenet/src/freenet/node/NodeClientCore.java
Log:
Doh, I forgot the l10n

Modified: trunk/freenet/src/freenet/client/ArchiveManager.java
===================================================================
--- trunk/freenet/src/freenet/client/ArchiveManager.java        2008-08-17 
12:23:06 UTC (rev 21958)
+++ trunk/freenet/src/freenet/client/ArchiveManager.java        2008-08-17 
12:30:39 UTC (rev 21959)
@@ -34,7 +34,8 @@
        public static final String METADATA_NAME = ".metadata";
        private static boolean logMINOR;

-       final long maxArchiveSize;
+       private long maxArchiveSize;
+
        final long maxArchivedFileSize;

        // ArchiveHandler's
@@ -471,4 +472,12 @@
                        return Metadata.ARCHIVE_ZIP;
                else throw new IllegalArgumentException(); 
        }
+       
+       public synchronized long getMaxArchiveSize() {
+               return maxArchiveSize;
+       }
+
+       public synchronized void setMaxArchiveSize(long maxArchiveSize) {
+               this.maxArchiveSize = maxArchiveSize;
+       }
 }

Modified: trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties
===================================================================
--- trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties   2008-08-17 
12:23:06 UTC (rev 21958)
+++ trunk/freenet/src/freenet/l10n/freenet.l10n.en.properties   2008-08-17 
12:30:39 UTC (rev 21959)
@@ -717,6 +717,8 @@
 Node.tooSmallMTUShort=Connection problems: Your connection's MTU is too short 
for Freenet to work well. Expect problems.
 Node.withAnnouncement=Allow the node to bootstrap itself using seednodes?
 Node.withAnnouncementLong=Allow the node to bootstrap itself using seednodes? 
While this has to be the default behaviour, it's insecure by design.
+NodeClientCore.maxArchiveSize=Maximum size of any given archive
+NodeClientCore.maxArchiveSizeLong=Maximum size of any given archive
 NodeClientCore.couldNotFindOrCreateDir=Could not find or create directory
 NodeClientCore.downloadAllowedDirs=Directories downloading is allowed to
 NodeClientCore.downloadAllowedDirsLong=Semicolon separated list of directories 
to which downloads are allowed. "downloads" means downloadsDir, empty means no 
downloads to disk allowed, "all" means downloads allowed from anywhere. 
WARNING! If this is set to "all" any user can download any file to anywhere on 
your computer!

Modified: trunk/freenet/src/freenet/node/NodeClientCore.java
===================================================================
--- trunk/freenet/src/freenet/node/NodeClientCore.java  2008-08-17 12:23:06 UTC 
(rev 21958)
+++ trunk/freenet/src/freenet/node/NodeClientCore.java  2008-08-17 12:30:39 UTC 
(rev 21959)
@@ -1,5 +1,6 @@
 package freenet.node;

+import freenet.config.NodeNeedRestartException;
 import java.io.File;
 import java.io.IOException;
 import java.net.URI;
@@ -101,7 +102,6 @@
        public static int maxBackgroundUSKFetchers;     // Client stuff that 
needs to be configged - FIXME
        static final int MAX_ARCHIVE_HANDLERS = 200; // don't take up much 
RAM... FIXME
        static final long MAX_CACHED_ARCHIVE_DATA = 32 * 1024 * 1024; // make a 
fixed fraction of the store by default? FIXME
-       static final long MAX_ARCHIVE_SIZE = 2 * 1024 * 1024; // ??? FIXME
        static final long MAX_ARCHIVED_FILE_SIZE = 1024 * 1024; // arbitrary... 
FIXME
        static final int MAX_CACHED_ELEMENTS = 256 * 1024; // equally 
arbitrary! FIXME hopefully we can cache many of these though
        private UserAlert startingUpAlert;
@@ -315,7 +315,21 @@
                        });
                
setUploadAllowedDirs(nodeConfig.getStringArr("uploadAllowedDirs"));

-               archiveManager = new ArchiveManager(MAX_ARCHIVE_HANDLERS, 
MAX_CACHED_ARCHIVE_DATA, MAX_ARCHIVE_SIZE, MAX_ARCHIVED_FILE_SIZE, 
MAX_CACHED_ELEMENTS, tempBucketFactory);
+               nodeConfig.register("maxArchiveSize", "5MiB", sortOrder++, 
true, false, "NodeClientCore.maxArchiveSize", 
"NodeClientCore.maxArchiveSizeLong", new LongCallback() {
+
+                       @Override
+                       public Long get() {
+                               return archiveManager.getMaxArchiveSize();
+                       }
+
+                       @Override
+                       public void set(Long val) throws 
InvalidConfigValueException, NodeNeedRestartException {
+                               if(val == get()) return;
+                               archiveManager.setMaxArchiveSize(val);
+                       }
+               });
+               
+               archiveManager = new ArchiveManager(MAX_ARCHIVE_HANDLERS, 
MAX_CACHED_ARCHIVE_DATA, nodeConfig.getLong("maxArchiveSize"), 
MAX_ARCHIVED_FILE_SIZE, MAX_CACHED_ELEMENTS, tempBucketFactory);
                Logger.normal(this, "Initializing USK Manager");
                System.out.println("Initializing USK Manager");
                uskManager = new USKManager(this);


Reply via email to