The security measurements were unnecessary, because the sum of the total-LIFO would...
authorHenning Rogge <hrogge@googlemail.com>
Sun, 22 Nov 2009 17:50:12 +0000 (18:50 +0100)
committerHenning Rogge <hrogge@googlemail.com>
Sun, 22 Nov 2009 17:50:12 +0000 (18:50 +0100)
src/lq_plugin_default_ff.c

index 4db0d8a..54e6eb6 100644 (file)
@@ -236,7 +236,7 @@ default_lq_ff_timer(void __attribute__ ((unused)) * context)
     }
 
     /* calculate link quality */
-    if (received + total == 0) {
+    if (total == 0) {
       tlq->lq.valueLq = 0;
     } else {
       // start with link-loss-factor
@@ -244,13 +244,7 @@ default_lq_ff_timer(void __attribute__ ((unused)) * context)
 
       /* keep missed hello periods in mind (round up hello interval to seconds) */
       if (tlq->missed_hellos > 1) {
-        int factor = tlq->missed_hellos * link->inter->hello_etime/1000;
-        if (factor >= LQ_FF_WINDOW) {
-          received = 0;
-        }
-        else {
-          received = received - received * factor / LQ_FF_WINDOW;
-        }
+        received = received - received * tlq->missed_hellos * link->inter->hello_etime/1000 / LQ_FF_WINDOW;
       }
 
       // calculate received/total factor