From 71efdc0b0207bfa8c1e4ad3eee9f4f26df6a58b4 Mon Sep 17 00:00:00 2001 From: Raj Bhattacharjea Date: Sat, 13 Dec 2008 23:44:20 -0500 Subject: [PATCH] Add a minimum RTO (adapted from Mathieu, bug 418) --- src/internet-stack/rtt-estimator.cc | 17 +++++++++++++++-- src/internet-stack/rtt-estimator.h | 1 + 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/src/internet-stack/rtt-estimator.cc b/src/internet-stack/rtt-estimator.cc index e6a849c7b..1cd0655cf 100644 --- a/src/internet-stack/rtt-estimator.cc +++ b/src/internet-stack/rtt-estimator.cc @@ -51,6 +51,11 @@ RttEstimator::GetTypeId (void) TimeValue (Seconds (1.0)), MakeTimeAccessor (&RttEstimator::est), MakeTimeChecker ()) + .AddAttribute ("MinRTO", + "Minimum retransmit timeout value", + TimeValue (Seconds (0.2)), + MakeTimeAccessor (&RttEstimator::minrto), + MakeTimeChecker ()) ; return tid; } @@ -217,9 +222,17 @@ Time RttMeanDeviation::RetransmitTimeout () { // If not enough samples, justjust return 2 times estimate //if (nSamples < 2) return est * 2; + Time retval; if (variance < est / Scalar (4.0)) - return est * Scalar (2 * multiplier); // At least twice current est - return (est + Scalar (4) * variance) * Scalar (multiplier); // As suggested by Jacobson + { + retval = est * Scalar (2 * multiplier); // At least twice current est + } + else + { + retval = (est + Scalar (4) * variance) * Scalar (multiplier); // As suggested by Jacobson + } + retval = Max (retval, minrto); + return retval; } Ptr RttMeanDeviation::Copy () const diff --git a/src/internet-stack/rtt-estimator.h b/src/internet-stack/rtt-estimator.h index 6ee3ad48b..8128d663f 100644 --- a/src/internet-stack/rtt-estimator.h +++ b/src/internet-stack/rtt-estimator.h @@ -76,6 +76,7 @@ private: double m_maxMultiplier; public: Time est; // Current estimate + Time minrto; // minimum value of the timeout uint32_t nSamples;// Number of samples double multiplier; // RTO Multiplier };