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

Modified Files:
      Tag: ngrouting
        NGRouting.java Routing.java TerminatableRouting.java 
        TreeRouting.java 
Log Message:
Build 7046:
Main objectives of this build are to improve routing success stats, fix deadlocks and 
fix RNFs.
Major ASL bugfix: fix race that could lead to connections getting closed without the 
client being notified.
MAJOR *SL work: Zab fixed some *SL deadlocks.
Change logging of success/failure of Routing, to take into account whether or not the 
failure was apparently caused by routing. Add new diagnostic vars 
requestFailureRoutingOrNotRatio, routingSuccessRatio. Change and consolidate 
terminate() calls all over request/. Minor changes all over states/request: Set 
insertReplyTime *before* sending it on, comment out logFailure*/logSuccess, update 
comments, logging, move *Time assignment after fromLastPeer check in 
receivedQueryRestarted (conceivably exploitable to bias stats), make backtracking 
QueryRejected async in Pending, make sure IOExceptions from the store are treated 
differently to IOExceptions from the network (which are like DNVs) in 
Pending.received(,DataReply), consolidate routes.terminate() calls into a function on 
RequestState, improve some toString()s, change exactly where we terminate the routing 
some places. Reindenting, code restyling


Index: NGRouting.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/rt/Attic/NGRouting.java,v
retrieving revision 1.1.2.14
retrieving revision 1.1.2.15
diff -u -r1.1.2.14 -r1.1.2.15
--- NGRouting.java      28 Aug 2003 17:38:03 -0000      1.1.2.14
+++ NGRouting.java      29 Aug 2003 18:58:06 -0000      1.1.2.15
@@ -52,7 +52,7 @@
                    continue;
                }
                last = null;
-               terminate(false);
+               terminate(false, true);
                return null;
            }
            last = list[at].ne;
@@ -77,8 +77,9 @@
        boolean ret = (node.connections.findFreeConnection(id) != null);
        long end = System.currentTimeMillis();
        if(logDEBUG)
-           Core.logger.log(this, "Checking for free conn took "+(end-start)+
-                           " for "+this, Logger.DEBUG);
+           Core.logger.log(this, "Checking for free conn for "+id+
+                           " took "+(end-start)+" for "+this+", result="+
+                           ret, Logger.DEBUG);
        return ret;
     }
     
@@ -175,22 +176,23 @@
                                                  ((double)size*1000)/
                                                  ((double)transferTime));
        }
-       terminate(true);
+       terminate(true, true);
     }
     
-    protected void reallyTerminate(boolean success) {
-       super.reallyTerminate(success);
+    protected void reallyTerminate(boolean success, boolean routingRelated) {
+       super.reallyTerminate(success, routingRelated);
        desperate = true;
        count = maxSteps+1;
        at = list.length;
        long t = System.currentTimeMillis()-origStartTime;
-       ngrt.globalEstimator.reportTime(key, t);
+       if(routingRelated)
+           ngrt.globalEstimator.reportTime(key, t);
     }
     
     public void dataNotFound(int htl) {
        long now = System.currentTimeMillis();
        last.dataNotFound(key, now - lastTime, htl);
        lastTime = now;
-       terminate(false);
+       terminate(false, true);
     }
 }

Index: Routing.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/rt/Routing.java,v
retrieving revision 1.6.6.6
retrieving revision 1.6.6.7
diff -u -r1.6.6.6 -r1.6.6.7
--- Routing.java        27 Aug 2003 15:54:35 -0000      1.6.6.6
+++ Routing.java        29 Aug 2003 18:58:06 -0000      1.6.6.7
@@ -120,7 +120,7 @@
      * Called to terminate the Routing, when it will no longer be called,
      * because of external circumstances e.g. ran out of HTL
      */
-    void terminate();
+    void terminate(boolean success, boolean routingRelated);
 }
 
 

Index: TerminatableRouting.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/rt/Attic/TerminatableRouting.java,v
retrieving revision 1.1.2.1
retrieving revision 1.1.2.2
diff -u -r1.1.2.1 -r1.1.2.2
--- TerminatableRouting.java    28 Aug 2003 17:38:04 -0000      1.1.2.1
+++ TerminatableRouting.java    29 Aug 2003 18:58:06 -0000      1.1.2.2
@@ -9,19 +9,21 @@
 abstract class TerminatableRouting implements Routing {
     boolean terminated = false;
     
-    public void terminate() {
-       terminate(false);
-    }
-
-    public void terminate(boolean success) {
+    public void terminate(boolean success, boolean routingRelated) {
        if(terminated) return;
        terminated = true;
-       reallyTerminate(success);
+       reallyTerminate(success, routingRelated);
     }
     
-    protected void reallyTerminate(boolean success) {
+    protected void reallyTerminate(boolean success, boolean routingRelated) {
        Core.diagnostics.occurrenceBinomial("requestSuccessRatio", 1, 
                                            success ? 1 : 0);
+       if(!success)
+           Core.diagnostics.occurrenceBinomial("requestFailureRoutingOrNotRatio",
+                                               1, routingRelated ? 1 : 0);
+       if(routingRelated)
+           Core.diagnostics.occurrenceBinomial("routingSuccessRatio",
+                                               1, success ? 1 : 0);
     }
     
     protected void finalize() {

Index: TreeRouting.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/rt/TreeRouting.java,v
retrieving revision 1.21.2.14
retrieving revision 1.21.2.15
diff -u -r1.21.2.14 -r1.21.2.15
--- TreeRouting.java    28 Aug 2003 17:38:04 -0000      1.21.2.14
+++ TreeRouting.java    29 Aug 2003 18:58:06 -0000      1.21.2.15
@@ -69,7 +69,7 @@
                                        desperate+", doDesperate="+
                                        doDesperate+", stepCount="+stepCount+" for "+
                                        refWalk, Logger.DEBUG);
-                   terminate(false);
+                   terminate(false, true);
                    return null;
                } else {
                    if(logDEBUG)
@@ -258,7 +258,7 @@
     };
     
     public void transferSucceeded(long time, int htl, long size, long etime) {
-       terminate(true);
+       terminate(true, true);
        long stdFileSize;
        if(node.dir.countKeys() > 16)
            stdFileSize = (node.storeSize - node.dir.available()) / 
@@ -276,12 +276,12 @@
     };
     
     public void dataNotFound(int htl) {
-       terminate(false);
+       terminate(false, true);
        // We don't care
     }
     
-    protected void reallyTerminate(boolean success) {
-       super.reallyTerminate(success);
+    protected void reallyTerminate(boolean success, boolean routingRelated) {
+       super.reallyTerminate(success, routingRelated);
        desperate = true;
        stepCount = node.maxRoutingSteps+1;
     }

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

Reply via email to