]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/lib/net/ctp/CtpRoutingEngineP.nc
after a few rounds of expts - enabling route trigger if we found a significantly...
[tinyos-2.x.git] / tos / lib / net / ctp / CtpRoutingEngineP.nc
index 120396ea75e89ffbc55ff983c5c0f618b401de2a..352938035f3999a048507887ac81a4e00eaca311 100644 (file)
@@ -297,8 +297,8 @@ implementation {
             /* Compute this neighbor's path metric */
             linkEtx = evaluateEtx(call LinkEstimator.getLinkQuality(entry->neighbor));
             dbg("TreeRouting", 
-                "routingTable[%d]: neighbor: [id: %d parent: %d etx: %d]\n",  
-                i, entry->neighbor, entry->info.parent, linkEtx);
+                "routingTable[%d]: neighbor: [id: %d parent: %d etx: %d retx: %d]\n",  
+                i, entry->neighbor, entry->info.parent, linkEtx, entry->info.etx);
             pathEtx = linkEtx + entry->info.etx;
             /* Operations specific to the current parent */
             if (entry->neighbor == routeInfo.parent) {
@@ -321,6 +321,7 @@ implementation {
             }
             
             if (pathEtx < minEtx) {
+             dbg("TreeRouting", "   best is %d, setting to %d\n", pathEtx, entry->neighbor);
                 minEtx = pathEtx;
                 best = entry;
             }  
@@ -354,11 +355,15 @@ implementation {
                 call LinkEstimator.unpinNeighbor(routeInfo.parent);
                 call LinkEstimator.pinNeighbor(best->neighbor);
                 call LinkEstimator.clearDLQ(best->neighbor);
-                atomic {
+
+               atomic {
                     routeInfo.parent = best->neighbor;
                     routeInfo.etx = best->info.etx;
                     routeInfo.congested = best->info.congested;
                 }
+               if (currentEtx - minEtx > 20) {
+                 call CtpInfo.triggerRouteUpdate();
+               }
             }
         }    
 
@@ -453,7 +458,7 @@ implementation {
     }
 
 
-    ctp_routing_header_t* getHeader(message_t* m) {
+    ctp_routing_header_t* getHeader(message_t* ONE m) {
       return (ctp_routing_header_t*)call BeaconSend.getPayload(m, call BeaconSend.maxPayloadLength());
     }