]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/lib/net/4bitle/LinkEstimatorP.nc
alpha=9; bug fix for getlinkquality - return infinity if not a mature link
[tinyos-2.x.git] / tos / lib / net / 4bitle / LinkEstimatorP.nc
index 616d44184afd3dab59676c4bbeda1fb9e53092f3..c428df1b0ce307b4034ddbea85c116941bbbbe0f 100644 (file)
@@ -70,7 +70,7 @@ implementation {
     INFINITY = 0xff,
     // decay the link estimate using this alpha
     // we use a denominator of 10, so this corresponds to 0.2
-    ALPHA = 2,
+    ALPHA = 9,
     // number of packets to wait before computing a new
     // DLQ (Data-driven Link Quality)
     DLQ_PKT_WINDOW = 5,
@@ -437,14 +437,18 @@ implementation {
   }
 
   // return bi-directional link quality to the neighbor
-  command uint8_t LinkEstimator.getLinkQuality(am_addr_t neighbor) {
+  command uint16_t LinkEstimator.getLinkQuality(am_addr_t neighbor) {
     uint8_t idx;
     idx = findIdx(neighbor);
     if (idx == INVALID_RVAL) {
       return INFINITY;
     } else {
-      return NeighborTable[idx].eetx;
-    };
+      if (NeighborTable[idx].flags & MATURE_ENTRY) {
+       return NeighborTable[idx].eetx;
+      } else {
+       return INFINITY;
+      }
+    }
   }
 
   // insert the neighbor at any cost (if there is a room for it)