[freenet-cvs] r17488 - trunk/freenet/src/freenet/node

toad at freenetproject.org toad at freenetproject.org
Sat Feb 2 23:42:17 UTC 2008


Author: toad
Date: 2008-02-02 23:42:17 +0000 (Sat, 02 Feb 2008)
New Revision: 17488

Modified:
   trunk/freenet/src/freenet/node/FailureTable.java
Log:
When we have deleted all the offers, delete the object containing the offers.

Modified: trunk/freenet/src/freenet/node/FailureTable.java
===================================================================
--- trunk/freenet/src/freenet/node/FailureTable.java	2008-02-02 23:38:43 UTC (rev 17487)
+++ trunk/freenet/src/freenet/node/FailureTable.java	2008-02-02 23:42:17 UTC (rev 17488)
@@ -165,7 +165,8 @@
 			return true;
 		}
 
-		public synchronized void deleteOffer(BlockOffer offer) {
+		public void deleteOffer(BlockOffer offer) {
+			synchronized(this) {
 			int idx = -1;
 			for(int i=0;i<offers.length;i++) {
 				if(offers[i] == offer) idx = i;
@@ -177,6 +178,12 @@
 			if(idx < newOffers.length)
 				System.arraycopy(offers, idx+1, newOffers, idx, offers.length-idx);
 			offers = newOffers;
+			}
+			if(offers.length == 0) {
+				synchronized(FailureTable.this) {
+					blockOfferListByKey.removeKey(entry.key);
+				}
+			}
 		}
 
 		public synchronized void addOffer(BlockOffer offer) {




More information about the cvs mailing list