use CopyObject and not Create to copy RttMeanDeviation. Implement the copy constructor correctly.

This commit is contained in:
Mathieu Lacage
2008-04-18 14:35:38 -07:00
parent a6321aac60
commit 6a93edb24e
2 changed files with 7 additions and 8 deletions

View File

@@ -74,12 +74,9 @@ RttEstimator::RttEstimator () : next (1), history (),
//note next=1 everywhere since first segment will have sequence 1
}
RttEstimator::RttEstimator (Time e) : next (1), history (), est (e),
nSamples (0), multiplier (1.0)
{ }
RttEstimator::RttEstimator(const RttEstimator& c)
: next(c.next), history(c.history), est(c.est), nSamples(c.nSamples),
: Object (c), next(c.next), history(c.history),
m_maxMultiplier (c.m_maxMultiplier), est(c.est), nSamples(c.nSamples),
multiplier(c.multiplier)
{}
@@ -144,6 +141,10 @@ void RttEstimator::ClearSent ()
void RttEstimator::IncreaseMultiplier ()
{
double a;
a = multiplier * 2.0;
double b;
b = m_maxMultiplier * 2.0;
multiplier = std::min (multiplier * 2.0, m_maxMultiplier);
}
@@ -223,7 +224,7 @@ Time RttMeanDeviation::RetransmitTimeout ()
Ptr<RttEstimator> RttMeanDeviation::Copy () const
{
return Create<RttMeanDeviation> (*this);
return CopyObject<RttMeanDeviation> (this);
}
void RttMeanDeviation::Reset ()

View File

@@ -51,7 +51,6 @@ public:
static TypeId GetTypeId (void);
RttEstimator();
RttEstimator(Time e);
RttEstimator(const RttEstimator&); // Copy constructor
virtual ~RttEstimator();
@@ -71,7 +70,6 @@ private:
SequenceNumber next; // Next expected sequence to be sent
RttHistory_t history; // List of sent packet
double m_maxMultiplier;
Time m_initialEstimate;
public:
Time est; // Current estimate
uint32_t nSamples;// Number of samples