I have a question about the cases that can happen when the LE receives a 
beacon. In processReceivedMessage function in the LinkEstimatorP.nc, LE can 
update the neighbour's entry if it exists (CASE 1). It will create a neighbour 
entry if it hears this neighbour for the first time (CASE 2). However, if the 
table it full, LE will find the worst neighbour and init the corresponding 
entry (CASE 3). If there is no worst neighbour, the LE will check with the 
router if it shall insert the neighbour, then chooses a random neighbour to 
evict (CASE 4).

            nidx = findIdx(ll_addr);

            if (nidx != INVALID_RVAL) 

                  updateNeighborEntryIdx(nidx, hdr->seq);                       
  //CASE 1

            else 

            {

                  nidx = findEmptyNeighborIdx();

                  if (nidx != INVALID_RVAL) 

                  {

                        initNeighborIdx(nidx, ll_addr);

                        updateNeighborEntryIdx(nidx, hdr->seq);                 
   //CASE 2

                  } 

                  else 

                  {

                        nidx = findWorstNeighborIdx(EVICT_ETX_THRESHOLD);

                        if (nidx != INVALID_RVAL) 

                        {

                              signal 
LinkEstimator.evicted(NeighborTable[nidx].ll_addr);

                              initNeighborIdx(nidx, ll_addr);                   
   //CASE 3

                        }

                        else 

                        {

                              //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); 
   //CASE 4

                                          }

                                    }

                              }

                        }

                  }

            }



My question is, why in the last two cases the LE init the entry and does not 
update it with the new info? Isn't it logical to update the neighbour info once 
I have a valid entry for it in the table?



Regards

Islam Hegazy


_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to