From 5a3ac82923305d21abfc0a924a3621fb34d91245 Mon Sep 17 00:00:00 2001 From: gnawali Date: Fri, 14 Aug 2009 18:09:43 +0000 Subject: [PATCH] fix bug - testing for large enough packetGap to recompute estimate is not enough. Reported by Mehmet Akif Antepli and Scott Moeller --- tos/lib/net/4bitle/LinkEstimatorP.nc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/tos/lib/net/4bitle/LinkEstimatorP.nc b/tos/lib/net/4bitle/LinkEstimatorP.nc index 6738a9f8..130d6415 100644 --- a/tos/lib/net/4bitle/LinkEstimatorP.nc +++ b/tos/lib/net/4bitle/LinkEstimatorP.nc @@ -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); } -- 2.39.2