Hi all,

In 4bitle implementation in updateNeighborEntryIdx() in LinkEstimatorP.nc has 
some redundant statements.

STATEMENT 1 can be removed because 'lastseq' is always set to 'seq' in 
STATEMENT 2

The order of STATEMENTS 3 and 4 means that we update a neighbour entry then 
init if packetGap > MAX_PKT_GAP. I think the order should be STATEMENT 4 then 
STATEMENT 3 with a 'return' at the end of SATEMENT 4.



void updateNeighborEntryIdx(uint8_t idx, uint8_t seq) 

{

      uint8_t packetGap;

 

    if (NeighborTable[idx].flags & INIT_ENTRY) 

      {

            dbg("LI", "Init entry update\n");

            NeighborTable[idx].lastseq = seq;                        
//STATEMENT 1

            NeighborTable[idx].flags &= ~INIT_ENTRY;

      }

    

    packetGap = seq - NeighborTable[idx].lastseq;

    dbg("LI", "updateNeighborEntryIdx: prevseq %d, curseq %d, gap %d\n", 
NeighborTable[idx].lastseq, seq, packetGap);

    NeighborTable[idx].lastseq = seq;                                
//STATEMENT 2

    NeighborTable[idx].rcvcnt++;

    if (packetGap > 0) 

            NeighborTable[idx].failcnt += packetGap - 1;

    

    // The or with packetGap >= BLQ_PKT_WINDOW is needed in case failcnt gets 
reset above

    if (                                                            //STATEMENT 
3

            ((NeighborTable[idx].rcvcnt + NeighborTable[idx].failcnt) >= 
BLQ_PKT_WINDOW)

            || 

            (packetGap >= BLQ_PKT_WINDOW)

            ) 

            updateNeighborTableEst(NeighborTable[idx].ll_addr);

 

    if (packetGap > MAX_PKT_GAP)                                     
//STATEMENT 4

      {

            initNeighborIdx(idx, NeighborTable[idx].ll_addr);

            NeighborTable[idx].lastseq = seq;

            NeighborTable[idx].rcvcnt = 1;

      }

}



Regards

Islam Hegazy


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

Reply via email to