mesh:Fixed valgrind errors
authorKirill Andreev <andreev@iitp.ru>
Thu Nov 05 13:45:33 2009 +0300 (3 months ago)
changeset 5528a019314e2ab3
parent 5527 ff7b28fe6a5c
child 5530 83baafea199f
mesh:Fixed valgrind errors
src/devices/mesh/dot11s/hwmp-protocol.cc
     1.1 --- a/src/devices/mesh/dot11s/hwmp-protocol.cc	Thu Nov 05 11:17:44 2009 +0100
     1.2 +++ b/src/devices/mesh/dot11s/hwmp-protocol.cc	Thu Nov 05 13:45:33 2009 +0300
     1.3 @@ -401,6 +401,7 @@
     1.4    //acceptance cretirea:
     1.5    std::map<Mac48Address, std::pair<uint32_t, uint32_t> >::const_iterator i = m_hwmpSeqnoMetricDatabase.find (
     1.6        preq.GetOriginatorAddress ());
     1.7 +  bool freshInfo (true);
     1.8    if (i != m_hwmpSeqnoMetricDatabase.end ())
     1.9      {
    1.10        if ((int32_t)(i->second.first - preq.GetOriginatorSeqNumber ())  > 0)
    1.11 @@ -409,6 +410,7 @@
    1.12          }
    1.13        if (i->second.first == preq.GetOriginatorSeqNumber ())
    1.14          {
    1.15 +          freshInfo = false;
    1.16            if (i->second.second <= preq.GetMetric ())
    1.17              {
    1.18                return;
    1.19 @@ -421,7 +423,7 @@
    1.20    std::vector<Ptr<DestinationAddressUnit> > destinations = preq.GetDestinationList ();
    1.21    //Add reactive path to originator:
    1.22    if (
    1.23 -      ((int32_t)(i->second.first - preq.GetOriginatorSeqNumber ())  < 0) ||
    1.24 +      (freshInfo) ||
    1.25        (
    1.26          (m_rtable->LookupReactive (preq.GetOriginatorAddress ()).retransmitter == Mac48Address::GetBroadcast ()) ||
    1.27          (m_rtable->LookupReactive (preq.GetOriginatorAddress ()).metric > preq.GetMetric ())
    1.28 @@ -562,9 +564,17 @@
    1.29    //acceptance cretirea:
    1.30    std::map<Mac48Address, std::pair<uint32_t, uint32_t> >::const_iterator i = m_hwmpSeqnoMetricDatabase.find (
    1.31        prep.GetOriginatorAddress ());
    1.32 -  if ((i != m_hwmpSeqnoMetricDatabase.end ()) && ((int32_t)(i->second.first - prep.GetOriginatorSeqNumber ()) > 0))
    1.33 +  bool freshInfo (true);
    1.34 +  if (i != m_hwmpSeqnoMetricDatabase.end ())
    1.35      {
    1.36 -      return;
    1.37 +      if ((int32_t)(i->second.first - prep.GetOriginatorSeqNumber ()) > 0)
    1.38 +        {
    1.39 +          return;
    1.40 +        }
    1.41 +      if (i->second.first == prep.GetOriginatorSeqNumber ())
    1.42 +        {
    1.43 +          freshInfo = false;
    1.44 +        }
    1.45      }
    1.46    m_hwmpSeqnoMetricDatabase[prep.GetOriginatorAddress ()] = std::make_pair (prep.GetOriginatorSeqNumber (), prep.GetMetric ());
    1.47    //update routing info
    1.48 @@ -574,7 +584,7 @@
    1.49    //Add a reactive path only if seqno is fresher or it improves the
    1.50    //metric
    1.51    if (
    1.52 -      (((int32_t)(i->second.first - prep.GetOriginatorSeqNumber ()) < 0)) ||
    1.53 +      (freshInfo) ||
    1.54        (
    1.55         ((m_rtable->LookupReactive (prep.GetOriginatorAddress ())).retransmitter == Mac48Address::GetBroadcast ()) ||
    1.56         ((m_rtable->LookupReactive (prep.GetOriginatorAddress ())).metric > prep.GetMetric ())