]> oss.titaniummirror.com Git - tinyos-2.x.git/commitdiff
<= will detect loops in which all the nodes have the same metric to the root
authorgnawali <gnawali>
Wed, 2 Jan 2008 04:02:45 +0000 (04:02 +0000)
committergnawali <gnawali>
Wed, 2 Jan 2008 04:02:45 +0000 (04:02 +0000)
tos/lib/net/ctp/CtpForwardingEngineP.nc

index 38609a4ceef84dbbb7b5b238a0ce44923905b967..eac244e8822948bdb8653586b9a376accdfc6e5b 100644 (file)
@@ -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,