X-Git-Url: https://oss.titaniummirror.com/gitweb/?a=blobdiff_plain;f=tos%2Flib%2Fnet%2Fctp%2FCtpRoutingEngineP.nc;h=f0ef1f60b6ab3a71ecf4bba28c7afdaf77fe7de7;hb=d6e4bc62926324801eee6ea48783dce663d5b6b2;hp=342f2f53d52360a21c53579416adb7a65a0bf6d4;hpb=ac19889e754777ca5b8e2d697ed6fa9b2c026fb0;p=tinyos-2.x.git diff --git a/tos/lib/net/ctp/CtpRoutingEngineP.nc b/tos/lib/net/ctp/CtpRoutingEngineP.nc index 342f2f53..f0ef1f60 100644 --- a/tos/lib/net/ctp/CtpRoutingEngineP.nc +++ b/tos/lib/net/ctp/CtpRoutingEngineP.nc @@ -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,17 @@ 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 we follow the CTP paper this should be in here. + if (currentEtx - minEtx > 20) { + call CtpInfo.triggerRouteUpdate(); + } + */ } }