use CopyObject and not Create to copy RttMeanDeviation. Implement the copy constructor correctly.
authorMathieu Lacage <mathieu.lacage@sophia.inria.fr>
Fri Apr 18 14:35:38 2008 -0700 (22 months ago)
changeset 29257149e19cada4
parent 2924 70a02c24d5eb
child 2973 e8d8a0650927
child 2988 8774a8c9526f
use CopyObject and not Create to copy RttMeanDeviation. Implement the copy constructor correctly.
src/internet-node/rtt-estimator.cc
src/internet-node/rtt-estimator.h
     1.1 --- a/src/internet-node/rtt-estimator.cc	Fri Apr 18 14:35:10 2008 -0700
     1.2 +++ b/src/internet-node/rtt-estimator.cc	Fri Apr 18 14:35:38 2008 -0700
     1.3 @@ -74,12 +74,9 @@
     1.4    //note next=1 everywhere since first segment will have sequence 1
     1.5  }
     1.6  
     1.7 -RttEstimator::RttEstimator (Time e) : next (1), history (), est (e),
     1.8 -    nSamples (0), multiplier (1.0) 
     1.9 -{ }
    1.10 -
    1.11  RttEstimator::RttEstimator(const RttEstimator& c)
    1.12 -  : next(c.next), history(c.history), est(c.est), nSamples(c.nSamples),
    1.13 +  : Object (c), next(c.next), history(c.history), 
    1.14 +    m_maxMultiplier (c.m_maxMultiplier), est(c.est), nSamples(c.nSamples),
    1.15      multiplier(c.multiplier)
    1.16  {}
    1.17  
    1.18 @@ -144,6 +141,10 @@
    1.19  
    1.20  void RttEstimator::IncreaseMultiplier ()
    1.21  {
    1.22 +  double a;
    1.23 +  a = multiplier * 2.0;
    1.24 +  double b;
    1.25 +  b = m_maxMultiplier * 2.0;
    1.26    multiplier = std::min (multiplier * 2.0, m_maxMultiplier);
    1.27  }
    1.28  
    1.29 @@ -223,7 +224,7 @@
    1.30  
    1.31  Ptr<RttEstimator> RttMeanDeviation::Copy () const
    1.32  {
    1.33 -  return Create<RttMeanDeviation> (*this);
    1.34 +  return CopyObject<RttMeanDeviation> (this);
    1.35  }
    1.36  
    1.37  void RttMeanDeviation::Reset ()
     2.1 --- a/src/internet-node/rtt-estimator.h	Fri Apr 18 14:35:10 2008 -0700
     2.2 +++ b/src/internet-node/rtt-estimator.h	Fri Apr 18 14:35:38 2008 -0700
     2.3 @@ -51,7 +51,6 @@
     2.4    static TypeId GetTypeId (void);
     2.5  
     2.6    RttEstimator();
     2.7 -  RttEstimator(Time e);
     2.8    RttEstimator(const RttEstimator&); // Copy constructor
     2.9    virtual ~RttEstimator();
    2.10  
    2.11 @@ -71,7 +70,6 @@
    2.12    SequenceNumber        next;    // Next expected sequence to be sent
    2.13    RttHistory_t history; // List of sent packet
    2.14    double m_maxMultiplier;
    2.15 -  Time m_initialEstimate;
    2.16  public:
    2.17    Time       est;     // Current estimate
    2.18    uint32_t      nSamples;// Number of samples