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

Modified Files:
        NodeEstimator.java StandardNodeEstimator.java 
Log Message:
improve nodestatus page with last estimate. make 6280 mandatory.


Index: NodeEstimator.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/rt/NodeEstimator.java,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -w -r1.4 -r1.5
--- NodeEstimator.java  17 Oct 2003 01:43:29 -0000      1.4
+++ NodeEstimator.java  27 Oct 2003 15:06:06 -0000      1.5
@@ -27,6 +27,7 @@
        abstract public long lastSuccessTime();
        abstract public long lastAccessedTime();
        abstract public long createdTime();
+       abstract public long lastEstimate();
        
     public RoutingMemory memory() {
                return mem;

Index: StandardNodeEstimator.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/rt/StandardNodeEstimator.java,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -w -r1.10 -r1.11
--- StandardNodeEstimator.java  25 Oct 2003 18:28:01 -0000      1.10
+++ StandardNodeEstimator.java  27 Oct 2003 15:06:06 -0000      1.11
@@ -39,6 +39,7 @@
        int consecutiveFailedConnects = 0;
        int successes = 0;
        boolean needConnection;
+       long lastEstimate = -1;
        
        public StandardNodeEstimator(NGRoutingTable ngrt, NodeReference ref,
                                                                 RoutingMemory mem, 
RunningAverageFactory raf,
@@ -187,7 +188,13 @@
                                                        +", tSuccess="+tSuccess+", 
estimate="+estimate+"ms",
                                                        Logger.MINOR);
                
-               return (long)estimate;
+               long e = (long)estimate;
+               lastEstimate = e;
+               return e;
+       }
+       
+       public long lastEstimate() {
+               return lastEstimate;
        }
        
        public void routeConnected(long time) {
@@ -508,8 +515,8 @@
        }
        
        private final static String[] REF_PROPERTIES =
-       { "Address", "Connection Probability", "Consecutive Failures",
-         "Connection Attempts", "Successful Connections", 
+       { "Address", "Last Estimate", "Connection Probability", 
+         "Consecutive Failures", "Connection Attempts", "Successful Connections", 
          "Last Attempt", "Successful Transfers", "Connection Fail Time",
          "Connection Success Time", "NodeReference", "Node Version", 
          "Search died probability", "Transfer died probability", 
@@ -538,14 +545,14 @@
                }
                
                protected int openConnections() {
-                       Integer outboundConnections = (Integer)objs[14];
-                       Integer inboundConnections = (Integer)objs[15];
+                       Integer outboundConnections = (Integer)objs[15];
+                       Integer inboundConnections = (Integer)objs[16];
                        return outboundConnections.intValue() +
                                inboundConnections.intValue();
                }
                
                protected int successes() {
-                       Integer successes = (Integer)objs[6];
+                       Integer successes = (Integer)objs[7];
                        return successes.intValue();
                }
                
@@ -559,27 +566,28 @@
        public ComparableStringMap getDiagProperties() {
                Object[] values = new Object[REF_PROPERTIES.length];
                values[0] = ref.firstPhysicalToString();
-               values[1] = new Float(1.0 - rpConnectFailed.currentValue());
-               values[2] = new Long(consecutiveFailedConnects);
-               values[3] = new Long(connectTries);
-               values[4] = new Long(connectSuccesses);
+               values[1] = new Long(lastEstimate);
+               values[2] = new Float(1.0 - rpConnectFailed.currentValue());
+               values[3] = new Long(consecutiveFailedConnects);
+               values[4] = new Long(connectTries);
+               values[5] = new Long(connectSuccesses);
                long now = System.currentTimeMillis();
                long secsSinceLastAttempt = -1;
                if(connectTries > 0) {
                        secsSinceLastAttempt = (now - lastConnectTryTime) / 1000;
                }
-               values[5] = new Long(secsSinceLastAttempt);
-               values[6] = new Integer(successes);
-               values[7] = new Integer((int)rtConnectFailed.currentValue());
-               values[8] = new Integer((int)rtConnected.currentValue());
-               values[9] = ref;
-               values[10] = ref.getVersion();
-               values[11] = new Float(rpSearchFailed.currentValue());
-               values[12] = new Float(rpTransferFailed.currentValue());
-               values[13] = new Float(rtSearchFailed.currentValue());
-               values[14] = 
-                       new Integer(ngrt.countOutboundConnections(ref.getIdentity()));
+               values[6] = new Long(secsSinceLastAttempt);
+               values[7] = new Integer(successes);
+               values[8] = new Integer((int)rtConnectFailed.currentValue());
+               values[9] = new Integer((int)rtConnected.currentValue());
+               values[10] = ref;
+               values[11] = ref.getVersion();
+               values[12] = new Float(rpSearchFailed.currentValue());
+               values[13] = new Float(rpTransferFailed.currentValue());
+               values[14] = new Float(rtSearchFailed.currentValue());
                values[15] = 
+                       new Integer(ngrt.countOutboundConnections(ref.getIdentity()));
+               values[16] = 
                        new Integer(ngrt.countInboundConnections(ref.getIdentity()));
                return new MyComparableStringMap(values);
        }

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

Reply via email to