From: gnawali Date: Wed, 2 Jan 2008 04:02:45 +0000 (+0000) Subject: <= will detect loops in which all the nodes have the same metric to the root X-Git-Tag: release_tinyos_2_1_0_0~612 X-Git-Url: https://oss.titaniummirror.com/gitweb/?p=tinyos-2.x.git;a=commitdiff_plain;h=3a90131d2b16435bd233b5d8bdf36b5644fa8957 <= will detect loops in which all the nodes have the same metric to the root --- 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,