fix: 在 ConsumerMIRCC 中加入超时处理,保证所有分片都成功拉取
This commit is contained in:
1 parent
b5b9169297
commit
55cc792099
4 files changed
+83
-76
No files matched your search
Vendored
+2
-1
@@ -1,6 +1,7 @@
|
||||
{
|
||||
"files.associations": {
|
||||
"*.txt": "cpp",
|
||||
"fstream": "cpp"
|
||||
"fstream": "cpp",
|
||||
"limits": "cpp"
|
||||
}
|
||||
}
|
||||
@@ -247,7 +247,8 @@ ConsumerMIRCC::SendPacket(uint64_t pathId,uint64_t classId)
|
||||
seq = m_seq++;
|
||||
}
|
||||
//
|
||||
seq2P[seq] = classId;
|
||||
seq2ClassId[seq] = classId;
|
||||
seq2PathId[seq] = pathId;
|
||||
|
||||
|
||||
if (classId == 1)
|
||||
@@ -333,8 +334,8 @@ void
|
||||
ConsumerMIRCC::SchedulePacketForPathId(uint64_t pathId,uint64_t classId)
|
||||
{
|
||||
SendPacket(pathId,classId);
|
||||
if (classId == 1)
|
||||
{//发送第一类兴趣包,参考当先path的Rp在所有Rp之和的占比 乘上最大Rp
|
||||
if (classId == 1) {
|
||||
//发送第一类兴趣包,参考当先path的Rp在所有Rp之和的占比 乘上最大Rp
|
||||
uint64_t tmpRp;
|
||||
if (m_greedy_tag == 0)
|
||||
{
|
||||
@@ -349,8 +350,8 @@ ConsumerMIRCC::SchedulePacketForPathId(uint64_t pathId,uint64_t classId)
|
||||
schcnt_p += 1;
|
||||
pathId2EventId_p[pathId] = Simulator::Schedule(Seconds(1.0 / (tmpRp / DATA_SIZE)), &ConsumerMIRCC::SchedulePacketForPathId,this, pathId,classId);
|
||||
|
||||
}else
|
||||
{//发送第二类兴趣包
|
||||
} else {
|
||||
//发送第二类兴趣包
|
||||
uint64_t tmpRs ;
|
||||
if (m_greedy_tag == 0)
|
||||
{
|
||||
@@ -442,7 +443,7 @@ ConsumerMIRCC::tryBindRandId(uint64_t seq, uint64_t pathId)
|
||||
if (pathId2EventId_s.find(pathId) == pathId2EventId_s.end())
|
||||
{
|
||||
uint64_t tmpRs = Rs;
|
||||
tmpRs = std::max(tmpRs,DATA_SIZE);
|
||||
tmpRs = std::max(tmpRs,DATA_SIZE);
|
||||
pathId2EventId_s[pathId] = Simulator::Schedule(Seconds(1.0 / (tmpRs / DATA_SIZE)), &ConsumerMIRCC::SchedulePacketForPathId,this, pathId,2);
|
||||
return;
|
||||
}
|
||||
@@ -451,7 +452,7 @@ ConsumerMIRCC::tryBindRandId(uint64_t seq, uint64_t pathId)
|
||||
auto tmp1 = Simulator::GetDelayLeft(pathId2EventId_s[pathId]);
|
||||
|
||||
|
||||
uint64_t tmpRs = Rs;
|
||||
uint64_t tmpRs = Rs;
|
||||
tmpRs = std::max(tmpRs,DATA_SIZE);
|
||||
Time tmp2 = Seconds(1.0 / (tmpRs / DATA_SIZE));
|
||||
|
||||
@@ -489,15 +490,17 @@ ConsumerMIRCC::OnData(shared_ptr<const Data> data)
|
||||
tryBindRandId(seq, *tmpPathid);
|
||||
}
|
||||
//if (appid == 1)
|
||||
//NS_LOG_DEBUG("seq " << seq << " ClassId " << seq2P[seq]);
|
||||
if (seq2P[seq] == 1)
|
||||
//NS_LOG_DEBUG("seq " << seq << " ClassId " << seq2ClassId[seq]);
|
||||
if (seq2ClassId[seq] == 1)
|
||||
{
|
||||
pktcnt_p += 1;
|
||||
}else
|
||||
{
|
||||
pktcnt_s += 1;
|
||||
}
|
||||
seq2P.erase(seq);
|
||||
seq2ClassId.erase(seq);
|
||||
seq2RandomId.erase(seq);
|
||||
seq2PathId.erase(seq);
|
||||
|
||||
|
||||
|
||||
@@ -554,7 +557,7 @@ ConsumerMIRCC::OnData(shared_ptr<const Data> data)
|
||||
}
|
||||
|
||||
void
|
||||
Consumer::OnTimeout(uint32_t sequenceNumber) {
|
||||
ConsumerMIRCC::OnTimeout(uint32_t sequenceNumber) {
|
||||
NS_LOG_FUNCTION(sequenceNumber);
|
||||
// std::cout << Simulator::Now () << ", TO: " << sequenceNumber << ", current RTO: " <<
|
||||
// m_rtt->RetransmitTimeout ().ToDouble (Time::S) << "s\n";
|
||||
@@ -563,7 +566,7 @@ Consumer::OnTimeout(uint32_t sequenceNumber) {
|
||||
m_rtt->SentSeq(SequenceNumber32(sequenceNumber),
|
||||
1); // make sure to disable RTT calculation for this sample
|
||||
m_retxSeqs.insert(sequenceNumber);
|
||||
ScheduleNextPacket();
|
||||
SchedulePacketForPathId(seq2PathId[sequenceNumber], seq2ClassId[sequenceNumber]);
|
||||
}
|
||||
}// namespace ndn
|
||||
} // namespace ns3
|
||||
@@ -53,7 +53,7 @@ protected:
|
||||
OnData(shared_ptr<const Data> data) override;
|
||||
|
||||
void
|
||||
OnTimeout(uint32_t sequenceNumber)
|
||||
OnTimeout(uint32_t sequenceNumber);
|
||||
|
||||
protected:
|
||||
//这两个目前没有用处
|
||||
@@ -78,8 +78,11 @@ private:
|
||||
|
||||
//
|
||||
std:: unordered_map <uint64_t,uint64_t> seq2RandomId;
|
||||
//
|
||||
std:: unordered_map <uint64_t,uint64_t> seq2P;
|
||||
// 序列号到 classId 的映射
|
||||
std::unordered_map<uint64_t, uint64_t> seq2ClassId;
|
||||
// 序列号到 pathId 的映射
|
||||
std::unordered_map<uint64_t, uint64_t> seq2PathId;
|
||||
|
||||
|
||||
const uint64_t INTEREST_SIZE = 200,DATA_SIZE = 8696,C = 1000 * 1000;
|
||||
|
||||
|
||||
@@ -50,93 +50,93 @@ namespace ns3
|
||||
consumerHelper.SetAttribute("start_ms",StringValue("0"));
|
||||
consumerHelper.SetAttribute("end_ms",StringValue("60000"));
|
||||
|
||||
// /Amazon
|
||||
consumerHelper.SetPrefix("/Amazon");
|
||||
consumerHelper.Install(C1);
|
||||
consumerHelper.Install(C2);
|
||||
consumerHelper.Install(C3);
|
||||
consumerHelper.Install(C4);
|
||||
consumerHelper.Install(C5);
|
||||
consumerHelper.Install(C6);
|
||||
consumerHelper.Install(C7);
|
||||
consumerHelper.Install(C8);
|
||||
|
||||
// /Google
|
||||
consumerHelper.SetPrefix("/Google");
|
||||
consumerHelper.Install(C1);
|
||||
consumerHelper.Install(C2);
|
||||
consumerHelper.Install(C3);
|
||||
consumerHelper.Install(C4);
|
||||
consumerHelper.Install(C5);
|
||||
consumerHelper.Install(C6);
|
||||
consumerHelper.Install(C7);
|
||||
consumerHelper.Install(C8);
|
||||
|
||||
// /Warner
|
||||
consumerHelper.SetPrefix("/Warner");
|
||||
consumerHelper.Install(C1);
|
||||
consumerHelper.Install(C2);
|
||||
consumerHelper.Install(C3);
|
||||
consumerHelper.Install(C4);
|
||||
consumerHelper.Install(C5);
|
||||
consumerHelper.Install(C6);
|
||||
consumerHelper.Install(C7);
|
||||
consumerHelper.Install(C8);
|
||||
|
||||
// // /Amazon
|
||||
// consumerHelper.SetPrefix("/Amazon/1");
|
||||
// consumerHelper.SetPrefix("/Amazon");
|
||||
// consumerHelper.Install(C1);
|
||||
// consumerHelper.SetPrefix("/Amazon/2");
|
||||
// consumerHelper.Install(C2);
|
||||
// consumerHelper.SetPrefix("/Amazon/3");
|
||||
// consumerHelper.Install(C3);
|
||||
// consumerHelper.SetPrefix("/Amazon/4");
|
||||
// consumerHelper.Install(C4);
|
||||
// consumerHelper.SetPrefix("/Amazon/5");
|
||||
// consumerHelper.Install(C5);
|
||||
// consumerHelper.SetPrefix("/Amazon/6");
|
||||
// consumerHelper.Install(C6);
|
||||
// consumerHelper.SetPrefix("/Amazon/7");
|
||||
// consumerHelper.Install(C7);
|
||||
// consumerHelper.SetPrefix("/Amazon/8");
|
||||
// consumerHelper.Install(C8);
|
||||
|
||||
// // /Google
|
||||
// consumerHelper.SetPrefix("/Google/1");
|
||||
// consumerHelper.SetPrefix("/Google");
|
||||
// consumerHelper.Install(C1);
|
||||
// consumerHelper.SetPrefix("/Google/2");
|
||||
// consumerHelper.Install(C2);
|
||||
// consumerHelper.SetPrefix("/Google/3");
|
||||
// consumerHelper.Install(C3);
|
||||
// consumerHelper.SetPrefix("/Google/4");
|
||||
// consumerHelper.Install(C4);
|
||||
// consumerHelper.SetPrefix("/Google/5");
|
||||
// consumerHelper.Install(C5);
|
||||
// consumerHelper.SetPrefix("/Google/6");
|
||||
// consumerHelper.Install(C6);
|
||||
// consumerHelper.SetPrefix("/Google/7");
|
||||
// consumerHelper.Install(C7);
|
||||
// consumerHelper.SetPrefix("/Google/8");
|
||||
// consumerHelper.Install(C8);
|
||||
|
||||
// // /Warner
|
||||
// consumerHelper.SetPrefix("/Warner/1");
|
||||
// consumerHelper.SetPrefix("/Warner");
|
||||
// consumerHelper.Install(C1);
|
||||
// consumerHelper.SetPrefix("/Warner/2");
|
||||
// consumerHelper.Install(C2);
|
||||
// consumerHelper.SetPrefix("/Warner/3");
|
||||
// consumerHelper.Install(C3);
|
||||
// consumerHelper.SetPrefix("/Warner/4");
|
||||
// consumerHelper.Install(C4);
|
||||
// consumerHelper.SetPrefix("/Warner/5");
|
||||
// consumerHelper.Install(C5);
|
||||
// consumerHelper.SetPrefix("/Warner/6");
|
||||
// consumerHelper.Install(C6);
|
||||
// consumerHelper.SetPrefix("/Warner/7");
|
||||
// consumerHelper.Install(C7);
|
||||
// consumerHelper.SetPrefix("/Warner/8");
|
||||
// consumerHelper.Install(C8);
|
||||
|
||||
// /Amazon
|
||||
consumerHelper.SetPrefix("/Amazon/1");
|
||||
consumerHelper.Install(C1);
|
||||
consumerHelper.SetPrefix("/Amazon/2");
|
||||
consumerHelper.Install(C2);
|
||||
consumerHelper.SetPrefix("/Amazon/3");
|
||||
consumerHelper.Install(C3);
|
||||
consumerHelper.SetPrefix("/Amazon/4");
|
||||
consumerHelper.Install(C4);
|
||||
consumerHelper.SetPrefix("/Amazon/5");
|
||||
consumerHelper.Install(C5);
|
||||
consumerHelper.SetPrefix("/Amazon/6");
|
||||
consumerHelper.Install(C6);
|
||||
consumerHelper.SetPrefix("/Amazon/7");
|
||||
consumerHelper.Install(C7);
|
||||
consumerHelper.SetPrefix("/Amazon/8");
|
||||
consumerHelper.Install(C8);
|
||||
|
||||
// /Google
|
||||
consumerHelper.SetPrefix("/Google/1");
|
||||
consumerHelper.Install(C1);
|
||||
consumerHelper.SetPrefix("/Google/2");
|
||||
consumerHelper.Install(C2);
|
||||
consumerHelper.SetPrefix("/Google/3");
|
||||
consumerHelper.Install(C3);
|
||||
consumerHelper.SetPrefix("/Google/4");
|
||||
consumerHelper.Install(C4);
|
||||
consumerHelper.SetPrefix("/Google/5");
|
||||
consumerHelper.Install(C5);
|
||||
consumerHelper.SetPrefix("/Google/6");
|
||||
consumerHelper.Install(C6);
|
||||
consumerHelper.SetPrefix("/Google/7");
|
||||
consumerHelper.Install(C7);
|
||||
consumerHelper.SetPrefix("/Google/8");
|
||||
consumerHelper.Install(C8);
|
||||
|
||||
// /Warner
|
||||
consumerHelper.SetPrefix("/Warner/1");
|
||||
consumerHelper.Install(C1);
|
||||
consumerHelper.SetPrefix("/Warner/2");
|
||||
consumerHelper.Install(C2);
|
||||
consumerHelper.SetPrefix("/Warner/3");
|
||||
consumerHelper.Install(C3);
|
||||
consumerHelper.SetPrefix("/Warner/4");
|
||||
consumerHelper.Install(C4);
|
||||
consumerHelper.SetPrefix("/Warner/5");
|
||||
consumerHelper.Install(C5);
|
||||
consumerHelper.SetPrefix("/Warner/6");
|
||||
consumerHelper.Install(C6);
|
||||
consumerHelper.SetPrefix("/Warner/7");
|
||||
consumerHelper.Install(C7);
|
||||
consumerHelper.SetPrefix("/Warner/8");
|
||||
consumerHelper.Install(C8);
|
||||
|
||||
ndn::AppHelper producerHelper("ns3::ndn::Producer");
|
||||
producerHelper.SetAttribute("PayloadSize", StringValue("1024"));
|
||||
|
||||
@@ -260,9 +260,9 @@ namespace ns3
|
||||
|
||||
Simulator::Stop(Seconds(60.0));
|
||||
|
||||
ndn::L3RateTracer::InstallAll("dsccp4-1-mircc_throughput-pit-merge.txt", Seconds(0.1));
|
||||
ndn::AppDelayTracer::InstallAll("dsccp4-1-mircc_delay--pit-merge.txt");
|
||||
L2RateTracer::InstallAll("dsccp4-1-mircc_drop-pit-merge.txt", Seconds(0.1));
|
||||
ndn::L3RateTracer::InstallAll("dsccp4-1-mircc-no-pit-merge-throughput.txt", Seconds(0.1));
|
||||
ndn::AppDelayTracer::InstallAll("dsccp4-1-mircc-no-pit-merge-delay.txt");
|
||||
L2RateTracer::InstallAll("dsccp4-1-mircc-no-pit-merge-drop.txt", Seconds(0.1));
|
||||
Simulator::Run();
|
||||
Simulator::Destroy();
|
||||
|
||||
|
||||
Reference in new issue
Block a user