Update of /cvsroot/freenet/freenet/src/freenet/node
In directory sc8-pr-cvs1:/tmp/cvs-serv10464/src/freenet/node

Modified Files:
        FailureTable.java 
Log Message:
Implement secondary failure table. If a request comes in that has failed twice, and 
the highest fail HTL is >= the request HTL, set a flag on it to ignore DNF; the result 
of this is that the estimators are not told about the DNF, and the stats get it as a 
non-routing-related failure.

Index: FailureTable.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/FailureTable.java,v
retrieving revision 1.17
retrieving revision 1.18
diff -u -w -r1.17 -r1.18
--- FailureTable.java   1 Nov 2003 22:05:37 -0000       1.17
+++ FailureTable.java   1 Nov 2003 22:35:34 -0000       1.18
@@ -150,6 +150,12 @@
         return fe.shouldFail(hopsToLive, time);
     }
 
+    public synchronized boolean statsShouldIgnoreDNF(Key k, int hopsToLive) {
+               FailureEntry fe = (FailureEntry) failedKeys.get(k);
+               if(fe == null) return false;
+               return fe.shouldIgnoreDNF(hopsToLive);
+    }
+    
     /**
      * @return true, if the Key is contained in the failuretable
      */
@@ -253,15 +259,21 @@
         private long lastHit;
         private long lastFail;
         private int failures;
+        private int highestHtl;
         
         LinkedList myItems;
         // java.util.LinkedList, NOT DoublyLinkedList, because we are already in 
items DLList
         
+        public boolean shouldIgnoreDNF(int hopsToLive) {
+               return (hopsToLive <= highestHtl && failures >1);
+        }
+        
         public FailureEntry(Key key, long time) {
                myItems = new LinkedList();
             this.key = key;
             this.blocks = 0;
             lastHit = time;
+            highestHtl = 0;
         }
         
         /**
@@ -296,6 +308,7 @@
                 */
                public void failed(int hopsToLive, long time) {
                        failures++;
+                       if(highestHtl < hopsToLive) highestHtl = hopsToLive;
                        lastFail = time;
                        boolean found = false;
                        for(Iterator i = myItems.iterator();i.hasNext();) {

_______________________________________________
cvs mailing list
[EMAIL PROTECTED]
http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/cvs

Reply via email to