chunks: don't blindly call Scheduler::cancellAllEvents()
Instead, keep track of the event we schedule and cancel only that one.
Change-Id: I9a2ae73073537bb1b67bceef85670add741cd542
diff --git a/tools/chunks/catchunks/pipeline-interests-aimd.cpp b/tools/chunks/catchunks/pipeline-interests-aimd.cpp
index cbff235..2b7af06 100644
--- a/tools/chunks/catchunks/pipeline-interests-aimd.cpp
+++ b/tools/chunks/catchunks/pipeline-interests-aimd.cpp
@@ -1,7 +1,7 @@
/**
- * Copyright (c) 2016, Regents of the University of California,
- * Colorado State University,
- * University Pierre & Marie Curie, Sorbonne University.
+ * Copyright (c) 2016-2017, Regents of the University of California,
+ * Colorado State University,
+ * University Pierre & Marie Curie, Sorbonne University.
*
* This file is part of ndn-tools (Named Data Networking Essential Tools).
* See AUTHORS.md for complete list of ndn-tools authors and contributors.
@@ -37,6 +37,7 @@
, m_options(options)
, m_rttEstimator(rttEstimator)
, m_scheduler(m_face.getIoService())
+ , m_checkRtoEvent(m_scheduler)
, m_nextSegmentNo(0)
, m_receivedSize(0)
, m_highData(0)
@@ -71,7 +72,7 @@
m_nReceived++;
// schedule the event to check retransmission timer
- m_scheduler.scheduleEvent(m_options.rtoCheckInterval, [this] { checkRto(); });
+ m_checkRtoEvent = m_scheduler.scheduleEvent(m_options.rtoCheckInterval, [this] { checkRto(); });
sendInterest(getNextSegmentNo(), false);
}
@@ -80,11 +81,10 @@
PipelineInterestsAimd::doCancel()
{
for (const auto& entry : m_segmentInfo) {
- const SegmentInfo& segInfo = entry.second;
- m_face.removePendingInterest(segInfo.interestId);
+ m_face.removePendingInterest(entry.second.interestId);
}
+ m_checkRtoEvent.cancel();
m_segmentInfo.clear();
- m_scheduler.cancelAllEvents();
}
void
@@ -114,7 +114,7 @@
}
// schedule the next check after predefined interval
- m_scheduler.scheduleEvent(m_options.rtoCheckInterval, [this] { checkRto(); });
+ m_checkRtoEvent = m_scheduler.scheduleEvent(m_options.rtoCheckInterval, [this] { checkRto(); });
}
void