A slightly modified FwPerFibLimits test. Modified ConsumerBatches
diff --git a/apps/ndn-consumer-batches.cc b/apps/ndn-consumer-batches.cc
index c4e93fb..398ec02 100644
--- a/apps/ndn-consumer-batches.cc
+++ b/apps/ndn-consumer-batches.cc
@@ -55,6 +55,7 @@
}
ConsumerBatches::ConsumerBatches ()
+ : m_initial (true)
{
}
@@ -74,6 +75,7 @@
// std::cout << Simulator::Now () << " adding batch of " << amount << "\n";
m_seqMax += amount;
m_rtt->ClearSent (); // this is important, otherwise RTT estimation for the new batch will be affected by previous batch history
+ m_initial = true;
ScheduleNextPacket ();
}
@@ -81,7 +83,13 @@
ConsumerBatches::ScheduleNextPacket ()
{
if (!m_sendEvent.IsRunning ())
- m_sendEvent = Simulator::Schedule (Seconds (m_rtt->RetransmitTimeout ().ToDouble (Time::S)), &Consumer::SendPacket, this);
+ {
+ Time delay = Seconds (0);
+ if (!m_initial) delay = m_rtt->RetransmitTimeout ();
+
+ m_initial = false;
+ m_sendEvent = Simulator::Schedule (delay, &Consumer::SendPacket, this);
+ }
}
///////////////////////////////////////////////////
diff --git a/apps/ndn-consumer-batches.h b/apps/ndn-consumer-batches.h
index c7479da..fc7b322 100644
--- a/apps/ndn-consumer-batches.h
+++ b/apps/ndn-consumer-batches.h
@@ -71,6 +71,9 @@
*/
virtual void
ScheduleNextPacket ();
+
+private:
+ bool m_initial;
};
} // namespace ndn
diff --git a/test/fw-per-fib-limits.cc b/test/fw-per-fib-limits.cc
index d66856e..859160a 100644
--- a/test/fw-per-fib-limits.cc
+++ b/test/fw-per-fib-limits.cc
@@ -105,8 +105,14 @@
ok = nodes.Get (0)->GetObject<L3Protocol> ()->GetFace (0)->GetLimits ()->TraceConnect ("CurMaxLimit", "face.curMax", MakeCallback (PrintTracedValue<double>));
NS_TEST_ASSERT_MSG_EQ (ok, true, "");
+ nodes.Get (0)->GetObject<L3Protocol> ()->GetFace (0)->GetLimits ()->TraceDisconnect ("CurMaxLimit", "face.curMax", MakeCallback (PrintTracedValue<double>));
+
ok = nodes.Get (0)->GetObject<L3Protocol> ()->GetFace (0)->GetLimits ()->TraceConnect ("Outstanding", "face.out", MakeCallback (PrintTracedValue<uint32_t>));
NS_TEST_ASSERT_MSG_EQ (ok, true, "");
+ nodes.Get (0)->GetObject<L3Protocol> ()->GetFace (0)->GetLimits ()->TraceDisconnect ("Outstanding", "face.out", MakeCallback (PrintTracedValue<uint32_t>));
+
+ Config::Connect ("/NodeList/0/$ns3::ndn::L3Protocol/FaceList/*/Limits/CurMaxLimit", MakeCallback (PrintTracedValue<double>));
+ Config::Connect ("/NodeList/0/$ns3::ndn::L3Protocol/FaceList/*/Limits/Outstanding", MakeCallback (PrintTracedValue<uint32_t>));
nodes.Get (0)->GetObject<L3Protocol> ()->GetFace (0)->GetLimits ()->SetMaxLimit (100);
@@ -137,16 +143,20 @@
Simulator::Schedule (Seconds (102.5), &FwPerFibLimits::CheckOutstanding, this, entry, 0);
Simulator::Schedule (Seconds (102.5), &FwPerFibLimits::CheckCurMaxLimit, this, entry, 41.75);
- // Config::Connect ("/NodeList/*/$ns3::ndn::L3Protocol/FaceList/*/Limits/CurMaxLimit", MakeCallback (PrintTracedValue<double>));
- // Config::Connect ("/NodeList/*/$ns3::ndn::L3Protocol/FaceList/*/Limits/Outstanding", MakeCallback (PrintTracedValue<uint32_t>));
-
AppHelper consumer ("ns3::ndn::ConsumerBatches");
consumer.SetPrefix ("/bla");
consumer.SetAttribute ("Batches", StringValue ("105 1"));
consumer.SetAttribute ("LifeTime", StringValue ("1s"));
- consumer.Install (nodes.Get (0));
+ consumer.Install (nodes.Get (0))
+ .Stop (Seconds (110.0));
+
+ Simulator::Schedule (Seconds (105.1), &FwPerFibLimits::CheckOutstanding, this, entry, 1);
+ Simulator::Schedule (Seconds (106.7), &FwPerFibLimits::CheckOutstanding, this, entry, 0);
+
+ Simulator::Schedule (Seconds (109.0), &FwPerFibLimits::CheckCurMaxLimit, this, entry, 14.27);
+ Simulator::Schedule (Seconds (119.9), &FwPerFibLimits::CheckCurMaxLimit, this, entry, 16.32);
- Simulator::Stop (Seconds (110.0));
+ Simulator::Stop (Seconds (120.0));
Simulator::Run ();
Simulator::Destroy ();