apps: Correcting behavior of ndn::ConsumerWindow.
It was erroneously suppressing transmission of new packets
diff --git a/apps/ndn-consumer-window.cc b/apps/ndn-consumer-window.cc
index 86457c8..4ae30dd 100644
--- a/apps/ndn-consumer-window.cc
+++ b/apps/ndn-consumer-window.cc
@@ -129,13 +129,19 @@
if (m_window == static_cast<uint32_t> (0) || m_inFlight >= m_window)
{
if (!m_sendEvent.IsRunning ())
- m_sendEvent = Simulator::Schedule (Seconds (m_rtt->RetransmitTimeout ().ToDouble (Time::S) * 0.1), &Consumer::SendPacket, this);
- return;
+ {
+ m_sendEvent = Simulator::Schedule (Seconds (m_rtt->RetransmitTimeout ().ToDouble (Time::S) * 0.1),
+ &Consumer::SendPacket, this);
+ }
}
-
- // std::cout << "Window: " << m_window << ", InFlight: " << m_inFlight << "\n";
- if (!m_sendEvent.IsRunning ())
+ else
{
+ if (m_sendEvent.IsRunning ())
+ {
+ Simulator::Remove (m_sendEvent);
+ }
+
+ NS_LOG_DEBUG ("Window: " << m_window << ", InFlight: " << m_inFlight);
m_inFlight++;
m_sendEvent = Simulator::ScheduleNow (&Consumer::SendPacket, this);
}
@@ -154,6 +160,8 @@
m_window = m_window + 1;
if (m_inFlight > static_cast<uint32_t> (0)) m_inFlight--;
+ NS_LOG_DEBUG ("Window: " << m_window << ", InFlight: " << m_inFlight);
+
ScheduleNextPacket ();
}
@@ -161,6 +169,7 @@
ConsumerWindow::OnNack (const Ptr<const InterestHeader> &interest, Ptr<Packet> payload)
{
Consumer::OnNack (interest, payload);
+
if (m_inFlight > static_cast<uint32_t> (0)) m_inFlight--;
if (m_window > static_cast<uint32_t> (0))
@@ -168,6 +177,8 @@
// m_window = 0.5 * m_window;//m_window - 1;
m_window = m_window - 1;
}
+
+ // NS_LOG_DEBUG ("Window: " << m_window);
}
void
diff --git a/apps/ndn-consumer.cc b/apps/ndn-consumer.cc
index f8090fe..dc36ed4 100644
--- a/apps/ndn-consumer.cc
+++ b/apps/ndn-consumer.cc
@@ -309,9 +309,9 @@
App::OnNack (interest, origPacket); // tracing inside
- NS_LOG_DEBUG ("Nack type: " << interest->GetNack ());
+ // NS_LOG_DEBUG ("Nack type: " << interest->GetNack ());
- NS_LOG_FUNCTION (this << interest);
+ // NS_LOG_FUNCTION (interest->GetName ());
// NS_LOG_INFO ("Received NACK: " << boost::cref(*interest));
uint32_t seq = boost::lexical_cast<uint32_t> (interest->GetName ().GetComponents ().back ());
@@ -319,9 +319,9 @@
// std::cout << Simulator::Now ().ToDouble (Time::S) << "s -> " << "NACK for " << seq << "\n";
// put in the queue of interests to be retransmitted
- NS_LOG_INFO ("Before: " << m_retxSeqs.size ());
+ // NS_LOG_INFO ("Before: " << m_retxSeqs.size ());
m_retxSeqs.insert (seq);
- NS_LOG_INFO ("After: " << m_retxSeqs.size ());
+ // NS_LOG_INFO ("After: " << m_retxSeqs.size ());
m_rtt->IncreaseMultiplier (); // Double the next RTO ??
ScheduleNextPacket ();