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

Modified Files:
        SmartFailureTable.java FailureTable.java 
Log Message:
have fun toad :)

Index: SmartFailureTable.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/SmartFailureTable.java,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -w -r1.2 -r1.3
--- SmartFailureTable.java      28 Oct 2003 17:35:04 -0000      1.2
+++ SmartFailureTable.java      28 Oct 2003 17:48:37 -0000      1.3
@@ -31,6 +31,7 @@
        }
        
        public synchronized void checkpoint() {
+                lastCp = System.currentTimeMillis();
                //override and do nothing, keys don't expire
        }
        
@@ -43,6 +44,31 @@
                        history = new LinkedList();
                        history.add(new FailureEntry(key, hopsToLive, time));
                }
+               public FailureEntry getOldestEntry() {
+                       return (FailureEntry) history.getFirst();
        }
        
+               public FailureEntry getNewestEntry() {
+                       return (FailureEntry) history.getLast();
+               }
+               
+               public void update(int hopsToLive, long time) {
+                       history.addLast(new FailureEntry(key,hopsToLive,time));
+               }
+       }
+       
+       /**
+        * override...
+        */
+       public synchronized void failedToFind(Key k, int hopsToLive, long time) {
+               ExtendedFailureEntry efe = (ExtendedFailureEntry) failedKeys.get(k);
+               if (efe==null){
+                       efe = new ExtendedFailureEntry(k, hopsToLive, time);
+                       failedKeys.put(k,efe);
+               } else 
+               if (hopsToLive >= efe.getNewestEntry().hopsToLive)  //FIXME: > or >=???
+                       efe.update(hopsToLive,time);
+                       
+               //FINISHUP: decide if the heap is needed.
+       }
 }

Index: FailureTable.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/FailureTable.java,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -w -r1.12 -r1.13
--- FailureTable.java   28 Oct 2003 17:35:04 -0000      1.12
+++ FailureTable.java   28 Oct 2003 17:48:37 -0000      1.13
@@ -54,12 +54,12 @@
 //          } 
 //      }
 
-    private int maxSize;
-    private long maxMillis;
-    private long lastCp = 0;
+    protected int maxSize;
+    protected long maxMillis;
+    protected long lastCp = 0;
 
-    private Hashtable failedKeys;
-    private Heap queue;
+    protected Hashtable failedKeys;
+    protected Heap queue;
 
     /**
      * Creates a new.
@@ -197,7 +197,7 @@
 
 
     protected class FailureEntry extends Element {
-        private int hopsToLive;
+        public int hopsToLive;  //screw getters...
         private Key key;
         private long time;
 

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

Reply via email to