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

Modified Files:
      Tag: ngrouting
        ResponseTimeEstimator.java 
Log Message:
logging, reporting, related to negative times


Index: ResponseTimeEstimator.java
===================================================================
RCS file: /cvsroot/freenet/freenet/src/freenet/node/rt/ResponseTimeEstimator.java,v
retrieving revision 1.4.2.22
retrieving revision 1.4.2.23
diff -u -r1.4.2.22 -r1.4.2.23
--- ResponseTimeEstimator.java  27 Aug 2003 01:27:41 -0000      1.4.2.22
+++ ResponseTimeEstimator.java  27 Aug 2003 02:00:00 -0000      1.4.2.23
@@ -457,6 +457,8 @@
     public synchronized void report(Key k, int usec) {
         BigInteger n = convert(k);
        
+       if(usec < 0) throw new IllegalArgumentException("negative usec in report()");
+       
        recentKeys[recentPtr] = n;
        recentTimes[recentPtr] = usec;
        recentCount++;
@@ -597,7 +599,7 @@
     private static int convertTime(long millis) {
        int x;
        if(millis < 0)
-           throw new IllegalArgumentException("Negative time");
+           throw new IllegalArgumentException("Negative time "+millis);
        if(millis > Integer.MAX_VALUE) {
            slogNORMAL("Very high reported time: "+millis);
            x = Integer.MAX_VALUE;
@@ -672,7 +674,10 @@
     }
     
     public String formatFromRaw(long x, int type) {
-       if(x < 0) throw new IllegalArgumentException("negative!");
+       if(x < 0) {
+           dumpLog();
+           throw new IllegalArgumentException("negative!");
+       }
        if(type == TIME) return Long.toString(x)+"ms";
        if(type == PROBABILITY) {
            if(x > Integer.MAX_VALUE) throw new IllegalArgumentException("to big 
probability");

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

Reply via email to