Author: toad
Date: 2006-09-28 17:47:32 +0000 (Thu, 28 Sep 2006)
New Revision: 10551

Modified:
   trunk/freenet/src/freenet/support/math/TimeDecayingRunningAverage.java
Log:
Check curValue for sanity after reporting value.

Modified: trunk/freenet/src/freenet/support/math/TimeDecayingRunningAverage.java
===================================================================
--- trunk/freenet/src/freenet/support/math/TimeDecayingRunningAverage.java      
2006-09-28 17:44:00 UTC (rev 10550)
+++ trunk/freenet/src/freenet/support/math/TimeDecayingRunningAverage.java      
2006-09-28 17:47:32 UTC (rev 10551)
@@ -178,6 +178,11 @@
                                double oldCurValue = curValue;
                                curValue = curValue * changeFactor /* close to 
1.0 if short interval, close to 0.0 if long interval */ 
                                        + (1.0 - changeFactor) * d;
+                               // FIXME remove when stop getting reports of 
wierd output values
+                               if(curValue < minReport || curValue > 
maxReport) {
+                                       Logger.error(this, 
"curValue="+curValue+" was "+oldCurValue+" - out of range");
+                                       curValue = oldCurValue;
+                               }
                                if(logDEBUG)
                                        Logger.debug(this, "Reported "+d+" on 
"+this+": thisInterval="+thisInterval+
                                                        ", 
halfLife="+halfLife+", uptime="+uptime+", thisHalfLife="+thisHalfLife+


Reply via email to