Author: toad
Date: 2008-01-18 15:25:37 +0000 (Fri, 18 Jan 2008)
New Revision: 17146

Modified:
   trunk/freenet/src/freenet/node/fcp/FCPServer.java
Log:
Actual persistence operations should be locked, but use sync(this) for just 
accessing enablePersistentDownloads.

Modified: trunk/freenet/src/freenet/node/fcp/FCPServer.java
===================================================================
--- trunk/freenet/src/freenet/node/fcp/FCPServer.java   2008-01-18 15:19:13 UTC 
(rev 17145)
+++ trunk/freenet/src/freenet/node/fcp/FCPServer.java   2008-01-18 15:25:37 UTC 
(rev 17146)
@@ -486,8 +486,11 @@
        }

        public void setPersistentDownloadsEnabled(boolean set) {
+               synchronized(this) {
+                       if(enablePersistentDownloads == set) return;
+                       enablePersistentDownloads = set;
+               }
                synchronized(persistenceSync) {
-                       if(enablePersistentDownloads == set) return;
                        if(set) {
                                if(!haveLoadedPersistentRequests)
                                        loadPersistentRequests();
@@ -496,14 +499,11 @@
                        } else {
                                killPersister();
                        }
-                       enablePersistentDownloads = set;
                }
        }

-       public boolean persistentDownloadsEnabled() {
-               synchronized(persistenceSync) {
-                       return enablePersistentDownloads;
-               }
+       public synchronized boolean persistentDownloadsEnabled() {
+               return enablePersistentDownloads;
        }

        public FCPClient registerClient(String name, NodeClientCore core, 
FCPConnectionHandler handler) {


Reply via email to