[Tinyos-2-commits] CVS: tinyos-2.x/tos/lib/net/collection
TreeRoutingEngineP.nc, 1.1.2.8, 1.1.2.9
Rodrigo Fonseca
rfonseca76 at users.sourceforge.net
Sun Jun 11 09:32:30 PDT 2006
Update of /cvsroot/tinyos/tinyos-2.x/tos/lib/net/collection
In directory sc8-pr-cvs10.sourceforge.net:/tmp/cvs-serv25785
Modified Files:
Tag: tinyos-2_0_devel-BRANCH
TreeRoutingEngineP.nc
Log Message:
Fixed a couple of bugs in updating the hopcount/metric of a node already a parent, which led to some problems when forming the tree.
The other is a quality filter condition to add nodes to the routing table.
Index: TreeRoutingEngineP.nc
===================================================================
RCS file: /cvsroot/tinyos/tinyos-2.x/tos/lib/net/collection/Attic/TreeRoutingEngineP.nc,v
retrieving revision 1.1.2.8
retrieving revision 1.1.2.9
diff -C2 -d -r1.1.2.8 -r1.1.2.9
*** TreeRoutingEngineP.nc 10 Jun 2006 19:24:22 -0000 1.1.2.8
--- TreeRoutingEngineP.nc 11 Jun 2006 16:32:28 -0000 1.1.2.9
***************
*** 196,201 ****
//for current parent
if (entry->neighbor == routeInfo.parent) {
- currentMetric = pathMetric;
dbg("TreeRouting", " already parent.\n");
continue;
}
--- 196,206 ----
//for current parent
if (entry->neighbor == routeInfo.parent) {
dbg("TreeRouting", " already parent.\n");
+ currentMetric = pathMetric;
+ //update routeInfo with parent's current info
+ atomic {
+ routeInfo.metric = entry->info.metric;
+ routeInfo.hopcount = entry->info.hopcount + 1;
+ }
continue;
}
***************
*** 480,486 ****
{
uint8_t idx;
idx = routingTableFind(from);
if (idx == routingTableSize) {
! //table is full
dbg("TreeRouting", "%s FAIL, table full\n", __FUNCTION__);
return FAIL;
--- 485,497 ----
{
uint8_t idx;
+ uint16_t linkMetric;
+ linkMetric = evaluateMetric(call LinkEstimator.getLinkQuality(from));
+
idx = routingTableFind(from);
if (idx == routingTableSize) {
! //not found and table is full
! //if (passLinkMetricThreshold(linkMetric))
! //TODO: add replacement here, replace the worst
! //}
dbg("TreeRouting", "%s FAIL, table full\n", __FUNCTION__);
return FAIL;
***************
*** 488,499 ****
else if (idx == routingTableActive) {
//not found and there is space
! atomic {
! routingTable[idx].neighbor = from;
! routingTable[idx].info.parent = parent;
! routingTable[idx].info.hopcount = hopcount;
! routingTable[idx].info.metric = metric;
! routingTableActive++;
}
- dbg("TreeRouting", "%s OK, new entry\n", __FUNCTION__);
} else {
//found, just update
--- 499,514 ----
else if (idx == routingTableActive) {
//not found and there is space
! if (passLinkMetricThreshold(linkMetric)) {
! atomic {
! routingTable[idx].neighbor = from;
! routingTable[idx].info.parent = parent;
! routingTable[idx].info.hopcount = hopcount;
! routingTable[idx].info.metric = metric;
! routingTableActive++;
! }
! dbg("TreeRouting", "%s OK, new entry\n", __FUNCTION__);
! } else {
! dbg("TreeRouting", "%s Fail, link quality (%hu) below threshold\n", __FUNCTION__, linkMetric);
}
} else {
//found, just update
More information about the Tinyos-2-commits
mailing list