Adding initial code to implement limited (by time) retransmission in CcnxConsumer
diff --git a/apps/ccnx-consumer.cc b/apps/ccnx-consumer.cc
index 15d8a81..a11d785 100644
--- a/apps/ccnx-consumer.cc
+++ b/apps/ccnx-consumer.cc
@@ -186,22 +186,25 @@
NS_LOG_FUNCTION_NOARGS ();
- uint32_t seq;
-
- if (m_retxSeqs.size () != 0)
+ uint32_t seq=std::numeric_limits<uint32_t>::max (); //invalid
+
+ while (m_retxSeqs.size ())
{
- // for (RetxSeqsContainer::const_iterator i=m_retxSeqs.begin (); i!=m_retxSeqs.end (); i++)
- // {
- // std::cout << *i << " ";
- // }
- // std::cout << "\n";
-
seq = *m_retxSeqs.begin ();
- NS_LOG_INFO ("Before: " << m_retxSeqs.size ());
m_retxSeqs.erase (m_retxSeqs.begin ());
- NS_LOG_INFO ("After: " << m_retxSeqs.size ());
+
+ // NS_ASSERT (m_seqLifetimes.find (seq) != m_seqLifetimes.end ());
+ // if (m_seqLifetimes.find (seq)->time <= Simulator::Now ())
+ // {
+
+ // NS_LOG_DEBUG ("Expire " << seq);
+ // m_seqLifetimes.erase (seq); // lifetime expired. Trying to find another unexpired sequence number
+ // continue;
+ // }
+ break;
}
- else
+
+ if (seq == std::numeric_limits<uint32_t>::max ())
{
if (m_seqMax > 0)
{
@@ -244,6 +247,7 @@
NS_LOG_DEBUG ("Trying to add " << seq << " with " << Simulator::Now () << ". already " << m_seqTimeouts.size () << " items");
m_seqTimeouts.insert (SeqTimeout (seq, Simulator::Now ()));
+ m_seqLifetimes.insert (SeqTimeout (seq, Simulator::Now () + m_interestLifeTime)); // only one insert will work. if entry exists, nothing will happen... nothing should happen
m_transmittedInterests (&interestHeader, this, m_face);
m_rtt->SentSeq (SequenceNumber32 (seq), 1);
@@ -278,6 +282,7 @@
// if (entry != m_seqTimeouts.end ())
// m_seqTimeouts.erase (entry);
+ m_seqLifetimes.erase (seq);
m_seqTimeouts.erase (seq);
m_retxSeqs.erase (seq);
diff --git a/apps/ccnx-consumer.h b/apps/ccnx-consumer.h
index 0030a81..0709a40 100644
--- a/apps/ccnx-consumer.h
+++ b/apps/ccnx-consumer.h
@@ -167,6 +167,7 @@
> { } ;
SeqTimeoutsContainer m_seqTimeouts; ///< \brief multi-index for the set of SeqTimeout structs
+ SeqTimeoutsContainer m_seqLifetimes;
/**
* \brief A trace that is called after each transmitted Interest packet
diff --git a/examples/link-failure-sprint.cc b/examples/link-failure-sprint.cc
index 903e406..88f2344 100644
--- a/examples/link-failure-sprint.cc
+++ b/examples/link-failure-sprint.cc
@@ -125,7 +125,16 @@
face1->SetUp (false);
face2->SetUp (false);
-
+
+ // set metric to max (for GlobalRouter to know what we want)
+ Ptr<Ipv4> ipv4_1 = ccnx1->GetObject<Ipv4> ();
+ Ptr<Ipv4> ipv4_2 = ccnx2->GetObject<Ipv4> ();
+
+ uint32_t if1 = ipv4_1->GetInterfaceForDevice (nd1);
+ uint32_t if2 = ipv4_2->GetInterfaceForDevice (nd2);
+
+ ipv4_1->SetMetric (if1, std::numeric_limits<uint16_t>::max ());
+ ipv4_2->SetMetric (if2, std::numeric_limits<uint16_t>::max ());
break;
}
}
@@ -226,6 +235,12 @@
return apps;
}
+ void
+ RecalculateRouting ()
+ {
+ Ipv4GlobalRoutingHelper::PopulateRoutingTables ();
+ }
+
private:
vector<failures_t> m_failures;
};
@@ -238,11 +253,14 @@
Config::SetDefault ("ns3::PointToPointNetDevice::DataRate", StringValue ("100Mbps"));
Config::SetDefault ("ns3::DropTailQueue::MaxPackets", StringValue ("2000"));
Config::SetDefault ("ns3::RttEstimator::InitialEstimation", StringValue ("0.5s"));
+ // Config::SetDefault ("ns3::RttEstimator::MaxMultiplier", StringValue ("16.0")); // original default is 64.0
Config::SetDefault ("ns3::ConfigStore::Filename", StringValue ("attributes.xml"));
Config::SetDefault ("ns3::ConfigStore::Mode", StringValue ("Save"));
Config::SetDefault ("ns3::ConfigStore::FileFormat", StringValue ("Xml"));
+ // Config::SetDefault ("ns3::CcnxConsumer::LifeTime", StringValue ("100s"));
+
uint32_t maxRuns = 1;
uint32_t startRun = 0;
std::string failures = "";
@@ -276,6 +294,7 @@
cout << "Total number of applications: " << apps.GetN () << "\n";
Simulator::Schedule (Seconds (10.0), &Experiment::FailLinks, &experiment, run);
+ Simulator::Schedule (Seconds (39.0), &Experiment::RecalculateRouting, &experiment);
//tracing
CcnxTraceHelper traceHelper;
@@ -284,7 +303,7 @@
Simulator::Schedule (Seconds (4.5), &CcnxTraceHelper::EnablePathWeights, &traceHelper,
prefix + "weights.log");
- experiment.Run (Seconds(40.0));
+ experiment.Run (Seconds(60.0));
}
cout << "Finish link failure scenario\n";