[Ns-bugs] [Bug 171] code bug in function (olsr)AgentImpl::MprComputation() about using std::vector::erase().

bugzilla-daemon@nsnam-www.ece.gatech.edu bugzilla-daemon at nsnam-www.ece.gatech.edu
Tue Apr 15 08:44:33 PDT 2008


http://www.nsnam.org/bugzilla/show_bug.cgi?id=171





------- Comment #3 from gjcarneiro at gmail.com  2008-04-15 11:44 -------
First of all, please submit the patch as unified diff (diff -upd); I can't read
this patch.  Moreover, from the little I can read from the patch it looks like
the patch is reversed?...

Then I must confess I did not write most of the code, simply ported it from
UM-OLSR (NS-2) to NS-3, so it is possible a bug or two prevailed...

Incidentally, I did find some code rather strange, even added one or two FIXME
comments.  For example:

void
OlsrState::EraseTwoHopNeighborTuples (const Ipv4Address &neighborMainAddr,
                                      const Ipv4Address &twoHopNeighborAddr)
{
  for (TwoHopNeighborSet::iterator it = m_twoHopNeighborSet.begin ();
       it != m_twoHopNeighborSet.end (); it++)
    {
      if (it->neighborMainAddr == neighborMainAddr
          && it->twoHopNeighborAddr == twoHopNeighborAddr)
        {
          it = m_twoHopNeighborSet.erase (it);
          it--; // FIXME: is this correct in the case 'it' pointed to the first
element?
          m_modified = true;
        }
    }
}

But, since the code appeared to work, even when simulating with hundreds or
thousands of nodes, when in doubt I chose to let it be.  If you say it is
giving segfaults then I'm all for fixing the code, as soon as you provided a
proper patch.  Thanks in advance.


-- 
Configure bugmail: http://www.nsnam.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.


More information about the Ns-bugs mailing list