Author: j16sdiz
Date: 2008-12-02 11:41:36 +0000 (Tue, 02 Dec 2008)
New Revision: 24002

Modified:
   trunk/freenet/src/freenet/store/saltedhash/SaltedHashFreenetStore.java
Log:
this should fix the windows resize hang
(not tested -- windows tester please try this!)

Modified: trunk/freenet/src/freenet/store/saltedhash/SaltedHashFreenetStore.java
===================================================================
--- trunk/freenet/src/freenet/store/saltedhash/SaltedHashFreenetStore.java      
2008-12-02 07:33:16 UTC (rev 24001)
+++ trunk/freenet/src/freenet/store/saltedhash/SaltedHashFreenetStore.java      
2008-12-02 11:41:36 UTC (rev 24002)
@@ -331,12 +331,10 @@
                                }
 
                                Entry entry = new Entry(routingKey, header, 
data);
-                               if (!storeFileSizeSetted && prevStoreSize != 0 
&& prevStoreSize < storeSize)
-                                       entry.storeSize = prevStoreSize;
                                long[] offset = entry.getOffset();
 
                                for (int i = 0; i < offset.length; i++) {
-                                       if (isFree(offset[i])) {
+                                       if (offset[i] >= storeFileSizeReady && 
isFree(offset[i])) {
                                                // write to free block
                                                if (logDEBUG)
                                                        Logger.debug(this, 
"probing, write to i=" + i + ", offset=" + offset[i]);
@@ -576,7 +574,7 @@
                }
        }
 
-       private boolean storeFileSizeSetted = false;
+       private volatile long storeFileSizeReady = 0;
 
        /**
         * Open all store files
@@ -604,7 +602,6 @@
                
                WrapperManager.signalStarting(10 * 60 * 1000); // 10minutes, 
for filesystem that support no sparse file.
                setStoreFileSize(storeFileSize, true);
-               storeFileSizeSetted = true;
                
                return newStore;
        }
@@ -789,8 +786,10 @@
                                                if(starting)
                                                        
WrapperManager.signalStarting(5*60*1000);
                                        }
+                                       storeFileSizeReady = oldHdLen / 
(headerBlockLength + dataBlockLength + hdPadding);
                                }
                        }
+                       storeFileSizeReady = storeFileSize;
 
                        metaRAF.setLength(newMetaLen);
                        hdRAF.setLength(newHdLen);
@@ -1024,7 +1023,6 @@
                                public void init() {
                                        if (storeSize > _prevStoreSize)
                                                setStoreFileSize(storeSize, 
false);
-                                       storeFileSizeSetted = true;
 
                                        optimialK = 
BloomFilter.optimialK(bloomFilterSize, storeSize);
                                        configLock.writeLock().lock();
@@ -1492,7 +1490,6 @@
 
                        prevStoreSize = storeSize;
                        storeSize = newStoreSize;
-                       storeFileSizeSetted = false;
                        writeConfigFile();
                } finally {
                        configLock.writeLock().unlock();

_______________________________________________
cvs mailing list
[email protected]
http://emu.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to