src/routing/olsr/olsr-agent-impl.cc
changeset 2972 d76553495b91
parent 2965 4b28e9740e3b
parent 2916 5d4ff983595b
child 3098 d384d52f8f6e
equal deleted inserted replaced
2971:75780f899be3 2972:d76553495b91
   570         {
   570         {
   571           mprSet.insert (neighbor->neighborMainAddr);
   571           mprSet.insert (neighbor->neighborMainAddr);
   572           // (not in RFC but I think is needed: remove the 2-hop
   572           // (not in RFC but I think is needed: remove the 2-hop
   573           // neighbors reachable by the MPR from N2)
   573           // neighbors reachable by the MPR from N2)
   574           for (TwoHopNeighborSet::iterator twoHopNeigh = N2.begin ();
   574           for (TwoHopNeighborSet::iterator twoHopNeigh = N2.begin ();
   575                twoHopNeigh != N2.end (); twoHopNeigh++)
   575                twoHopNeigh != N2.end (); )
   576             {
   576             {
   577               if (twoHopNeigh->neighborMainAddr == neighbor->neighborMainAddr)
   577               if (twoHopNeigh->neighborMainAddr == neighbor->neighborMainAddr)
   578                 {
   578                 {
   579                   twoHopNeigh = N2.erase (twoHopNeigh);
   579                   twoHopNeigh = N2.erase (twoHopNeigh);
   580                   twoHopNeigh--;
   580                 }
       
   581               else
       
   582                 {
       
   583                   twoHopNeigh++;
   581                 }
   584                 }
   582             }
   585             }
   583         }
   586         }
   584     }
   587     }
   585   
   588   
   615           coveredTwoHopNeighbors.insert (twoHopNeigh->twoHopNeighborAddr);
   618           coveredTwoHopNeighbors.insert (twoHopNeigh->twoHopNeighborAddr);
   616         }
   619         }
   617     }
   620     }
   618   // Remove the nodes from N2 which are now covered by a node in the MPR set.
   621   // Remove the nodes from N2 which are now covered by a node in the MPR set.
   619   for (TwoHopNeighborSet::iterator twoHopNeigh = N2.begin ();
   622   for (TwoHopNeighborSet::iterator twoHopNeigh = N2.begin ();
   620        twoHopNeigh != N2.end (); twoHopNeigh++)
   623        twoHopNeigh != N2.end (); )
   621     {
   624     {
   622       if (coveredTwoHopNeighbors.find (twoHopNeigh->twoHopNeighborAddr) != coveredTwoHopNeighbors.end ())
   625       if (coveredTwoHopNeighbors.find (twoHopNeigh->twoHopNeighborAddr) != coveredTwoHopNeighbors.end ())
   623         {
   626         {
   624           twoHopNeigh = N2.erase (twoHopNeigh);
   627           twoHopNeigh = N2.erase (twoHopNeigh);
   625           twoHopNeigh--;
   628         }
       
   629       else
       
   630         {
       
   631           twoHopNeigh++;
   626         }
   632         }
   627     }
   633     }
   628 	
   634 	
   629   // 4. While there exist nodes in N2 which are not covered by at
   635   // 4. While there exist nodes in N2 which are not covered by at
   630   // least one node in the MPR set:
   636   // least one node in the MPR set:
   697 
   703 
   698       if (max != NULL)
   704       if (max != NULL)
   699         {
   705         {
   700           mprSet.insert (max->neighborMainAddr);
   706           mprSet.insert (max->neighborMainAddr);
   701           for (TwoHopNeighborSet::iterator twoHopNeigh = N2.begin ();
   707           for (TwoHopNeighborSet::iterator twoHopNeigh = N2.begin ();
   702                twoHopNeigh != N2.end (); twoHopNeigh++)
   708                twoHopNeigh != N2.end (); )
   703             {
   709             {
   704               if (twoHopNeigh->neighborMainAddr == max->neighborMainAddr)
   710               if (twoHopNeigh->neighborMainAddr == max->neighborMainAddr)
   705                 {
   711                 {
   706                   twoHopNeigh = N2.erase (twoHopNeigh);
   712                   twoHopNeigh = N2.erase (twoHopNeigh);
   707                   twoHopNeigh--;
   713                 }
       
   714               else
       
   715                 {
       
   716                   twoHopNeigh++;
   708                 }
   717                 }
   709             }
   718             }
   710         }
   719         }
   711     }
   720     }
   712 
   721