Author: toad
Date: 2008-03-24 23:16:25 +0000 (Mon, 24 Mar 2008)
New Revision: 18753

Modified:
   trunk/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java
Log:
Paranoia

Modified: trunk/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java
===================================================================
--- trunk/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java      
2008-03-24 23:14:27 UTC (rev 18752)
+++ trunk/freenet/src/freenet/client/async/SplitFileFetcherSubSegment.java      
2008-03-24 23:16:25 UTC (rev 18753)
@@ -126,6 +126,14 @@
                                synchronized(this) {
                                        blockNums.add(ret);
                                }
+                               // Double check that it hasn't been found.
+                               key = 
segment.getBlockNodeKey(((Integer)ret).intValue());
+                               if(key == null) {
+                                       // A race condition is possible but 
should only rarely cause a Key is null for block <block>.
+                                       synchronized(this) {
+                                               blockNums.add(ret);
+                                       }
+                               }
                                continue;
                        }
                        if(logMINOR)


Reply via email to