From 3a90131d2b16435bd233b5d8bdf36b5644fa8957 Mon Sep 17 00:00:00 2001 From: gnawali Date: Wed, 2 Jan 2008 04:02:45 +0000 Subject: [PATCH] <= will detect loops in which all the nodes have the same metric to the root --- tos/lib/net/ctp/CtpForwardingEngineP.nc | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tos/lib/net/ctp/CtpForwardingEngineP.nc b/tos/lib/net/ctp/CtpForwardingEngineP.nc index 38609a4c..eac244e8 100644 --- a/tos/lib/net/ctp/CtpForwardingEngineP.nc +++ b/tos/lib/net/ctp/CtpForwardingEngineP.nc @@ -684,9 +684,11 @@ implementation { // Loop-detection code: if (call CtpInfo.getEtx(&gradient) == SUCCESS) { // We only check for loops if we know our own metric - if (call CtpPacket.getEtx(m) < gradient) { - // The incoming packet's metric (gradient) is less than our - // own gradient. Trigger a route update and backoff. + if (call CtpPacket.getEtx(m) <= gradient) { + // If our etx metric is less than or equal to the etx value + // on the packet (etx of the previous hop node), then we believe + // we are in a loop. + // Trigger a route update and backoff. call CtpInfo.triggerImmediateRouteUpdate(); startRetxmitTimer(LOOPY_WINDOW, LOOPY_OFFSET); call CollectionDebug.logEventMsg(NET_C_FE_LOOP_DETECTED, -- 2.39.2