]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/lib/net/4bitle/LinkEstimatorP.nc
updates to the compare bit interface/use of white bit
[tinyos-2.x.git] / tos / lib / net / 4bitle / LinkEstimatorP.nc
index 7e5c9dacc8264d4b1f5994de2599e63b69ffd557..d0f307561959d68849379c391768b9a68b6287c1 100644 (file)
@@ -644,14 +644,20 @@ implementation {
            initNeighborIdx(nidx, ll_addr);
          } else {
            dbg("LI", "No room in the table\n");
-           if (signal CompareBit.shouldInsert(msg, 
-                                              call Packet.getPayload(msg, call Packet.payloadLength(msg)),
-                                              call Packet.payloadLength(msg),
-                                              call LinkPacketMetadata.highChannelQuality(msg))) {
-             nidx = findRandomNeighborIdx();
-             if (nidx != INVALID_RVAL) {
-               signal LinkEstimator.evicted(NeighborTable[nidx].ll_addr);
-               initNeighborIdx(nidx, ll_addr);
+
+           /* if the white bit is set, lets ask the router if the path through
+              this link is better than at least one known path - if so
+              lets insert this link into the table.
+           */
+           if (call LinkPacketMetadata.highChannelQuality(msg)) {
+             if (signal CompareBit.shouldInsert(msg, 
+                                                call Packet.getPayload(msg, call Packet.payloadLength(msg)),
+                                                call Packet.payloadLength(msg))) {
+               nidx = findRandomNeighborIdx();
+               if (nidx != INVALID_RVAL) {
+                 signal LinkEstimator.evicted(NeighborTable[nidx].ll_addr);
+                 initNeighborIdx(nidx, ll_addr);
+               }
              }
            }
          }