X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=tos%2Flib%2Fnet%2Fctp%2FCtpForwardingEngineP.nc;h=eac244e8822948bdb8653586b9a376accdfc6e5b;hb=3a90131d2b16435bd233b5d8bdf36b5644fa8957;hp=38609a4ceef84dbbb7b5b238a0ce44923905b967;hpb=ed5c09b9b7f07d0f531a32852bf3e6bd48588046;p=tinyos-2.x.git 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,