Issue #25: fix the logic in SentSeq and AckSeq to capture retx and support random seq
diff --git a/utils/ndn-rtt-mean-deviation.cc b/utils/ndn-rtt-mean-deviation.cc
index 8675479..c05ad75 100644
--- a/utils/ndn-rtt-mean-deviation.cc
+++ b/utils/ndn-rtt-mean-deviation.cc
@@ -131,6 +131,25 @@
m_gain = g;
}
+void RttMeanDeviation::SentSeq (SequenceNumber32 seq, uint32_t size)
+{
+ NS_LOG_FUNCTION (this << seq << size);
+
+ RttHistory_t::iterator i;
+ for (i = m_history.begin (); i != m_history.end (); ++i)
+ {
+ if (seq == i->seq)
+ { // Found it
+ i->retx = true;
+ break;
+ }
+ }
+
+ // Note that a particular sequence has been sent
+ if (i == m_history.end())
+ m_history.push_back (RttHistory (seq, size, Simulator::Now () ));
+}
+
Time RttMeanDeviation::AckSeq (SequenceNumber32 ackSeq)
{
NS_LOG_FUNCTION (this << ackSeq);
@@ -144,9 +163,11 @@
{
if (ackSeq == i->seq)
{ // Found it
- m = Simulator::Now () - i->time;// Elapsed time
- Measurement (m); // Log the measurement
- ResetMultiplier (); // Reset multiplier on valid measurement
+ if (!i->retx) {
+ m = Simulator::Now () - i->time;// Elapsed time
+ Measurement (m); // Log the measurement
+ ResetMultiplier (); // Reset multiplier on valid measurement
+ }
m_history.erase(i);
break;
}
diff --git a/utils/ndn-rtt-mean-deviation.h b/utils/ndn-rtt-mean-deviation.h
index 7ceecce..e8b419c 100644
--- a/utils/ndn-rtt-mean-deviation.h
+++ b/utils/ndn-rtt-mean-deviation.h
@@ -51,6 +51,7 @@
RttMeanDeviation ();
RttMeanDeviation (const RttMeanDeviation&);
+ void SentSeq (SequenceNumber32 seq, uint32_t size);
Time AckSeq (SequenceNumber32 ackSeq);
void Measurement (Time measure);
Time RetransmitTimeout ();