Author: toad
Date: 2008-01-25 18:53:24 +0000 (Fri, 25 Jan 2008)
New Revision: 17291
Modified:
trunk/freenet/src/freenet/io/comm/MessageCore.java
Log:
waitFor(): If the filter times out, and then is re-added, and the old copy
isn't removed from the list before the new one is added, it can end up blocking
the removal of later filters.
So remove it in waitFor() if it times out.
Modified: trunk/freenet/src/freenet/io/comm/MessageCore.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/MessageCore.java 2008-01-25 18:22:11 UTC
(rev 17290)
+++ trunk/freenet/src/freenet/io/comm/MessageCore.java 2008-01-25 18:53:24 UTC
(rev 17291)
@@ -453,6 +453,17 @@
}
if(logDEBUG) Logger.debug(this, "Returning "+ret+" from
"+filter);
}
+ if(!filter.matched()) {
+ // We must remove it from _filters before we return, or
when it is re-added,
+ // it will be in the list twice, and that will cause
other filters not to be
+ // dropped.
+ synchronized(_filters) {
+ // Fortunately, it will be close to the
beginning of the filters list, having
+ // just timed out. That is assuming it hasn't
already been removed; in that
+ // case, this will be slower.
+ _filters.remove(filter);
+ }
+ }
// Matched a packet, unclaimed or after wait
filter.setMessage(ret);
filter.onMatched();