|
716 |
if (max == NULL || nb_tuple->willingness > max->willingness) |
718 |
if (max == NULL || nb_tuple->willingness > max->willingness) |
717 |
{ |
719 |
{ |
718 |
max = nb_tuple; |
720 |
max = nb_tuple; |
|
|
721 |
for (TwoHopNeighborSet::iterator newCovered = N2.begin (); newCovered != N2.end (); newCovered++) |
722 |
{ |
723 |
coveredTwoHopNeighbors.insert (newCovered->twoHopNeighborAddr); |
724 |
} |
719 |
max_r = r; |
725 |
max_r = r; |
720 |
} |
726 |
} |
721 |
else if (nb_tuple->willingness == max->willingness) |
727 |
else if (nb_tuple->willingness == max->willingness) |
|
740 |
if (max != NULL) |
746 |
if (max != NULL) |
741 |
{ |
747 |
{ |
742 |
mprSet.insert (max->neighborMainAddr); |
748 |
mprSet.insert (max->neighborMainAddr); |
743 |
for (TwoHopNeighborSet::iterator twoHopNeigh = N2.begin (); |
749 |
// Remove the nodes from N2 which are now covered by a node in the MPR set. |
744 |
twoHopNeigh != N2.end (); ) |
750 |
for (TwoHopNeighborSet::iterator twoHopNeigh = N2.begin (); twoHopNeigh != N2.end (); ) |
745 |
{ |
751 |
{ |
746 |
if (twoHopNeigh->neighborMainAddr == max->neighborMainAddr) |
752 |
if (coveredTwoHopNeighbors.find (twoHopNeigh->twoHopNeighborAddr) != coveredTwoHopNeighbors.end ()) |
747 |
{ |
753 |
{ |
|
|
754 |
NS_LOG_LOGIC ("2-hop neigh. " << twoHopNeigh->twoHopNeighborAddr << " is already covered by an MPR."); |
748 |
twoHopNeigh = N2.erase (twoHopNeigh); |
755 |
twoHopNeigh = N2.erase (twoHopNeigh); |
749 |
} |
756 |
} |
750 |
else |
757 |
else |