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

Modified Files:
      Tag: ngrouting
        FilterRoutingTable.java NGRouting.java NGRoutingTable.java 
        RoutingTable.java TreeRoutingTable.java 
Log Message:
7050: Fix a race in ConnectionOpener that was probably the source of the RNFs. Sort 
the routing table display in nodestatus. Add a parameter to route() to indicate 
whether the request is an insert. Get rid of now redundant pWildLegitDNF in NGRT. 
Change routing termination again esp w.r.t. inserts. Don't null routes, we need it for 
the StoreData. Catch anything thrown by process() when running maintqueue in RSL. 
Indenting. Logging.


Index: FilterRoutingTable.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/rt/FilterRoutingTable.java,v
retrieving revision 1.5.2.3
retrieving revision 1.5.2.4
diff -u -r1.5.2.3 -r1.5.2.4
--- FilterRoutingTable.java     20 Aug 2003 18:09:21 -0000      1.5.2.3
+++ FilterRoutingTable.java     30 Aug 2003 19:49:51 -0000      1.5.2.4
@@ -56,8 +56,9 @@
        return rt.getNodeReference(id);
     }
     
-    public final Routing route(Key k, int htl, long size, boolean force) {
-        return rt.route(k, htl, size, force);
+    public final Routing route(Key k, int htl, long size, boolean force,
+                              boolean isInsert) {
+        return rt.route(k, htl, size, force, isInsert);
     }
     
     public final RoutingStore getRoutingStore() {

Index: NGRouting.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/rt/Attic/NGRouting.java,v
retrieving revision 1.1.2.17
retrieving revision 1.1.2.18
diff -u -r1.1.2.17 -r1.1.2.18
--- NGRouting.java      30 Aug 2003 01:23:01 -0000      1.1.2.17
+++ NGRouting.java      30 Aug 2003 19:49:51 -0000      1.1.2.18
@@ -28,9 +28,10 @@
     Node node;
     boolean hasSearchFailed = false;
     long origStartTime;
+    boolean isInsert;
     
     NGRouting(NGRoutingTable ngrt, Estimate[] list, int maxSteps, Key k,
-             boolean doDesperate, Node n) {
+             boolean doDesperate, Node n, boolean isInsert) {
        origStartTime = System.currentTimeMillis();
        this.list = list;
        last = null;
@@ -39,8 +40,9 @@
        this.key = k;
        this.ngrt = ngrt;
        this.doDesperate = doDesperate;
-       logDEBUG = Core.logger.shouldLog(Logger.DEBUG);
        this.node = n;
+       logDEBUG = n.logger.shouldLog(Logger.DEBUG);
+       this.isInsert = isInsert;
     }
     
     public NodeReference getNextRoute() {
@@ -63,7 +65,7 @@
            if(desperate || freeConn(ref.getIdentity())) {
                hasSearchFailed = false;
                lastTime = System.currentTimeMillis();
-               logDEBUG = Core.logger.shouldLog(Logger.DEBUG);
+               logDEBUG = node.logger.shouldLog(Logger.DEBUG);
                return ref;
            }
        }
@@ -72,14 +74,14 @@
     // FIXME: factor out to superclass. duped in TreeRouting.
     protected boolean freeConn(Identity id) {
        if(logDEBUG)
-           Core.logger.log(this, "Checking for free conn...", Logger.DEBUG);
+           node.logger.log(this, "Checking for free conn...", Logger.DEBUG);
        long start = System.currentTimeMillis();
        boolean ret = (node.connections.findFreeConnection(id) != null);
        if(!ret)
            node.scheduleConnectionOpener(id);
        long end = System.currentTimeMillis();
        if(logDEBUG)
-           Core.logger.log(this, "Checking for free conn for "+id+
+           node.logger.log(this, "Checking for free conn for "+id+
                            " took "+(end-start)+" for "+this+", result="+
                            ret, Logger.DEBUG);
        return ret;
@@ -147,7 +149,7 @@
            hasSearchFailed = true;
            last.searchFailed(time);
        } else {
-           Core.logger.log(this, "Search failed twice for "+this,
+           node.logger.log(this, "Search failed twice for "+this,
                            new Exception("debug"), Logger.NORMAL);
        }
     }

Index: NGRoutingTable.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/rt/Attic/NGRoutingTable.java,v
retrieving revision 1.1.2.20
retrieving revision 1.1.2.21
diff -u -r1.1.2.20 -r1.1.2.21
--- NGRoutingTable.java 30 Aug 2003 01:23:01 -0000      1.1.2.20
+++ NGRoutingTable.java 30 Aug 2003 19:49:52 -0000      1.1.2.21
@@ -30,7 +30,6 @@
        public double defaultFastestTransferSeen;
        double pLegitDNF = 1.0;
        double pSemiLegitDNF = 1.0;
-       double pWildLegitDNF = 1.0;
        File[] globalFiles = 
        { new File(Node.routingDir, "ngrt_global_a"),
          new File(Node.routingDir, "ngrt_global_b") };
@@ -146,14 +145,14 @@
        }
        
        public synchronized Routing route(Key k, int htl, long size, 
-                                                                         boolean 
force) {
+                                                                         boolean 
force, 
+                                                                         boolean 
isInsert) {
                Vector v = new Vector(maxNodes);
                Enumeration e = estimators.elements();
                
                // FIXME!
                pLegitDNF = 1.0F;
                pSemiLegitDNF = 1.0F;
-               pWildLegitDNF = 1.0F;
                int nonWild = 0;
                int semiWild = 0;
                while(e.hasMoreElements()) {
@@ -161,7 +160,6 @@
                        // All nodes are routable
                        v.add(ne);
                        double d = ne.dnfProbability();
-                       if(pWildLegitDNF > d) pWildLegitDNF = d;
                        if(ne.successes() >= 1) {
                                semiWild++;
                                if(pSemiLegitDNF > d) pSemiLegitDNF = d;
@@ -173,10 +171,8 @@
                        // FIXME!
                }
                if(nonWild < maxNodes / 4) {
-                       if(semiWild > 0 && semiWild >= maxNodes / 4) {
+                       if(semiWild > 0) {
                                pLegitDNF = pSemiLegitDNF;
-                       } else {
-                               pLegitDNF = pWildLegitDNF;
                        }
                }
                e = v.elements();
@@ -186,7 +182,7 @@
                while(e.hasMoreElements()) {
                        NodeEstimator ne = (NodeEstimator)(e.nextElement());
                        Estimate es = new Estimate(ne, ne.estimate(k, htl, size,
-                                                                                      
                   global, pLegitDNF));
+                                                                                      
                    global, pLegitDNF));
                        estimates[i] = es;
                        i++;
                }
@@ -195,7 +191,7 @@
                return new NGRouting(this, estimates, force ? estimates.length :
                                                         Math.min(estimates.length, 
                                                                          
freenet.node.Node.maxRoutingSteps),
-                                                        k, force, node);
+                                                        k, force, node, isInsert);
        }
        
        public synchronized RTDiagSnapshot getSnapshot() {
@@ -248,18 +244,19 @@
                props[5] = new Long(totalConnectSuccesses);
                props[6] = new Float(pLegitDNF);
                props[7] = new Float(pSemiLegitDNF);
-               props[8] = new Float(pWildLegitDNF);
-               props[9] = new String(globalEstimator.
+               props[8] = new String(globalEstimator.
                                                           
formatFromRaw(globalEstimator.lowestRaw(), 
                                                                                       
  globalEstimator.TIME));
-               props[10] = new String(globalEstimator.
+               props[9] = new String(globalEstimator.
                                                           
formatFromRaw(globalEstimator.highestRaw(),
                                                                                       
  globalEstimator.TIME));
-               props[11] = getClass().getName();
+               props[10] = getClass().getName();
                StringMap sm = new SimpleStringMap(TABLE_PROPERTIES, props);
                // FIXME!
                StringMap[] refs = new StringMap[refInfos.size()];
                refs = (StringMap[])(refInfos.toArray(refs));
+               ArraySorter ar = new ArraySorter(refs); // use native sort order
+               QuickSorter.quickSort(ar);
                return new SimpleRTDiagSnapshot(sm, refs, null, realRefs);
        }
        
@@ -269,7 +266,6 @@
                   "Connections with Successful Transfers", "Connection Attempts",
                   "Successful Connections", "Probability of legitimate DNF",
                   "Worse guess probability of legitimate DNF",
-                  "Wild guess probability of legitimate DNF",
                   "Lowest global time estimate", "Highest global time estimate",
                   "Implementation"};
        

Index: RoutingTable.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/rt/RoutingTable.java,v
retrieving revision 1.5.2.3
retrieving revision 1.5.2.4
diff -u -r1.5.2.3 -r1.5.2.4
--- RoutingTable.java   20 Aug 2003 18:09:21 -0000      1.5.2.3
+++ RoutingTable.java   30 Aug 2003 19:49:52 -0000      1.5.2.4
@@ -43,7 +43,8 @@
      * @param force whether to try to contact backed off nodes
      * @return      the generated Routing object
      */
-    Routing route(Key k, int htl, long size, boolean force);
+    Routing route(Key k, int htl, long size, boolean force,
+                 boolean isInsert);
     
     /**
      * NOTE:  It is important to hold the sync-lock

Index: TreeRoutingTable.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/rt/TreeRoutingTable.java,v
retrieving revision 1.22.2.5
retrieving revision 1.22.2.6
diff -u -r1.22.2.5 -r1.22.2.6
--- TreeRoutingTable.java       30 Jul 2003 23:50:54 -0000      1.22.2.5
+++ TreeRoutingTable.java       30 Aug 2003 19:49:52 -0000      1.22.2.6
@@ -97,11 +97,12 @@
     }
     
     public synchronized Routing route(Key k, int htl, long size) {
-       return route(k, htl, size, false);
+       return route(k, htl, size, false, false);
     }
     
     public synchronized Routing route(Key k, int htl, long size, 
-                                     boolean doDesperate) {
+                                     boolean doDesperate,
+                                     boolean isInsert) {
        long x = -1;
        
        boolean logDEBUG = Core.logger.shouldLog(Logger.DEBUG);

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

Reply via email to