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

Modified Files:
        NGRoutingTable.java StandardNodeEstimator.java 
Log Message:
6375:
Logging, mostly. Clarify some routing code.

Index: NGRoutingTable.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/rt/NGRoutingTable.java,v
retrieving revision 1.64
retrieving revision 1.65
diff -u -w -r1.64 -r1.65
--- NGRoutingTable.java 4 Dec 2003 00:20:23 -0000       1.64
+++ NGRoutingTable.java 5 Dec 2003 02:29:33 -0000       1.65
@@ -356,6 +356,10 @@
                                       boolean force, 
                                       boolean isInsert,
                                                                          boolean 
orderByInexperience) {
+       if(Core.logger.shouldLog(Logger.DEBUG, this))
+               Core.logger.log(this, "Routing "+k+", hopsToLive="+htl+", size="+size+
+                               ", force="+force+", isInsert="+isInsert+", 
orderByInexperience="+
+                               orderByInexperience, new Exception("debug"), 
Logger.DEBUG);
         updateNewNodeStats();
         Vector v = new Vector(maxNodes);
         Enumeration e;
@@ -380,7 +384,7 @@
                if(es == null) throw new NullPointerException();
             }
             if(es == null) throw new NullPointerException();
-                       Core.logger.log(this, "estimates["+i+"] = "+es,
+                       Core.logger.log(this, "estimates["+i+"] = "+es+" ("+k+")",
                                                                        Logger.DEBUG);
             estimates[i] = es;
             i++;
@@ -389,8 +393,8 @@
         QuickSorter.quickSort(vs);
                if(Core.logger.shouldLog(Logger.DEBUG, this)) {
                        for(int x=0;x<estimates.length;x++)
-                               Core.logger.log(this, "Estimates["+x+"] = 
"+estimates[x],
-                                       Logger.DEBUG);
+                               Core.logger.log(this, "Estimates["+x+"] = 
"+estimates[x]+
+                                               " ("+k+")", Logger.DEBUG);
                }
                return new NGRouting(this, estimates, force ? estimates.length :
                              Math.min(estimates.length, 

Index: StandardNodeEstimator.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/rt/StandardNodeEstimator.java,v
retrieving revision 1.63
retrieving revision 1.64
diff -u -w -r1.63 -r1.64
--- StandardNodeEstimator.java  2 Dec 2003 15:43:50 -0000       1.63
+++ StandardNodeEstimator.java  5 Dec 2003 02:29:33 -0000       1.64
@@ -341,10 +341,11 @@
                double success = -1;
                if(pSuccess > 1 || pSuccess < 0) {
                        Core.logger.log(this, "pSuccess = "+pSuccess, Logger.ERROR);
-                       e = Long.MAX_VALUE;
+                       estimate = e = Long.MAX_VALUE;
                } else {
                        success = totalTSuccess(k, pDNF, transferRate, tSuccessSearch, 
size);
-                       e = (long)(estimate + (success * pSuccess));
+                       estimate += (success * pSuccess);
+                       e = (long)estimate;
                }
                lastEstimate = e;
                if(Math.abs(e) > (long)(Math.pow(10,11))) {
@@ -364,8 +365,8 @@
                                                        ", 
tTransferFailed="+tTransferFailed+", pDNF="+pDNF+
                                                        ", tDNF="+tDNF+", 
pLegitDNF="+pLegitDNF
                                                        +", totalTSuccess="+success
-                                                       +", pSuccess="+pSuccess+", 
estimate="+estimate+"ms",
-                                                       Logger.MINOR);
+                                                       +", pSuccess="+pSuccess+", 
estimate="+estimate+"ms"
+                                                       +" ("+e+"): ", Logger.MINOR);
                return es;
        }
        

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

Reply via email to