Author: toad
Date: 2008-01-25 19:03:03 +0000 (Fri, 25 Jan 2008)
New Revision: 17293

Modified:
   trunk/freenet/src/freenet/io/comm/MessageCore.java
Log:
Debugging paranoia: if a debug flag is set (which for now it is), check the 
rest of the queue, and log an error if we find anything.

Modified: trunk/freenet/src/freenet/io/comm/MessageCore.java
===================================================================
--- trunk/freenet/src/freenet/io/comm/MessageCore.java  2008-01-25 18:55:13 UTC 
(rev 17292)
+++ trunk/freenet/src/freenet/io/comm/MessageCore.java  2008-01-25 19:03:03 UTC 
(rev 17293)
@@ -94,6 +94,9 @@
        }, FILTER_REMOVE_TIME);
     }

+    // FIXME debugging paranoia - turn off for maximum performance
+    static final boolean DEBUG_CHECK_REST_OF_QUEUE = true;
+    
     /**
      * Remove timed out filters.
      */
@@ -117,6 +120,17 @@
                                        // doesn't timeout
                                        if(Logger.shouldLog(Logger.DEBUG, this))
                                                Logger.debug(this, "Stopping 
removing timed out filters at "+f+" : timeout = "+f.getTimeout()+" initial 
timeout = "+f.getInitialTimeout());
+                                       if(DEBUG_CHECK_REST_OF_QUEUE) {
+                                               while(i.hasNext()) {
+                                                       MessageFilter f1 = 
(MessageFilter) i.next();
+                                                       if(f1.getTimeout() < 
tStart) {
+                                                               
Logger.error(this, "Still failing to timeout all filters! Filter "+f1+" timeout 
"+f1.getTimeout()+" matched but would have stopped at filter "+f+" timeout 
"+f.getTimeout()+" at time "+tStart);
+                                                               i.remove();
+                                                               
_timedOutFilters.add(f);
+                                                       }
+                                                               
+                                               }
+                                       }
                                        break;
                                }
                        }


Reply via email to