Author: j16sdiz
Date: 2008-05-11 17:04:21 +0000 (Sun, 11 May 2008)
New Revision: 19895

Modified:
   
branches/saltedhashstore/freenet/src/freenet/store/SaltedHashFreenetStore.java
Log:
stat fix


Modified: 
branches/saltedhashstore/freenet/src/freenet/store/SaltedHashFreenetStore.java
===================================================================
--- 
branches/saltedhashstore/freenet/src/freenet/store/SaltedHashFreenetStore.java  
    2008-05-11 15:35:41 UTC (rev 19894)
+++ 
branches/saltedhashstore/freenet/src/freenet/store/SaltedHashFreenetStore.java  
    2008-05-11 17:04:21 UTC (rev 19895)
@@ -156,16 +156,22 @@
                if (logMINOR)
                        Logger.minor(this, "Putting " + 
HexUtil.bytesToHex(routingKey) + " for " + callback);

-               StorableBlock oldBlock = fetch(routingKey, fullKey, false);
+               // don't use fetch(), as fetch() would do a miss++/hit++
+               Entry oldEntry = probeEntry(routingKey);

-               if (oldBlock != null) {
-                       if (!collisionPossible)
-                               return;
-                       if (block.equals(oldBlock)) {
-                               return; // already in store
-                       } else {
-                               if (!overwrite)
-                                       throw new KeyCollisionException();
+               if (oldEntry != null) {
+                       try {
+                               StorableBlock oldBlock = 
oldEntry.getStorableBlock(routingKey, fullKey);
+                               if (!collisionPossible)
+                                       return;
+                               if (block.equals(oldBlock)) {
+                                       return; // already in store
+                               } else {
+                                       if (!overwrite)
+                                               throw new 
KeyCollisionException();
+                               }
+                       } catch (KeyVerifyException e) {
+                               // ignore
                        }
                }



Reply via email to