apps: Solving a serious bug #33 in ndn::ConsumerWindow
In certain cases, the number of in-flight packets was maintained in a
wrong way, creating inconsistencies and incorrect decision on when to
send out a new Interests. That is, the number of in-flight
packets could be non-zero, while there were no outstanding packets at all.
Thanks to Cheng Yi for the bug discovery
diff --git a/apps/ndn-consumer-window.cc b/apps/ndn-consumer-window.cc
index 7e8325d..a2e29b3 100644
--- a/apps/ndn-consumer-window.cc
+++ b/apps/ndn-consumer-window.cc
@@ -151,8 +151,6 @@
Simulator::Remove (m_sendEvent);
}
- // NS_LOG_DEBUG ("Window: " << m_window << ", InFlight: " << m_inFlight);
- m_inFlight++;
m_sendEvent = Simulator::ScheduleNow (&Consumer::SendPacket, this);
}
}
@@ -208,5 +206,13 @@
Consumer::OnTimeout (sequenceNumber);
}
+void
+ConsumerWindow::WillSendOutInterest (uint32_t sequenceNumber)
+{
+ m_inFlight ++;
+ Consumer::WillSendOutInterest (sequenceNumber);
+}
+
+
} // namespace ndn
} // namespace ns3