]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/lib/net/4bitle/LinkEstimatorP.nc
fix bug - testing for large enough packetGap to recompute estimate is not enough...
[tinyos-2.x.git] / tos / lib / net / 4bitle / LinkEstimatorP.nc
index 6738a9f8e6093af01c2b2d12f8f81d0aa81c1c1c..130d64159f7f085a3518c91f1f603b6c40cd6f59 100644 (file)
@@ -376,7 +376,11 @@ implementation {
       NeighborTable[idx].inquality = 0;
     }
 
-    if (packetGap >= BLQ_PKT_WINDOW) {
+    // The or with packetGap >= BLQ_PKT_WINDOW is needed in case
+    // failcnt gets reset above
+
+    if (((NeighborTable[idx].rcvcnt + NeighborTable[idx].failcnt) >= BLQ_PKT_WINDOW)
+       || (packetGap >= BLQ_PKT_WINDOW)) {
       updateNeighborTableEst(NeighborTable[idx].ll_addr);
     }