fw: consumer retansmission in multicast startegy
refs: #2062
Change-Id: I2b58a289fffe262c69a797f339e40ad9037acf8f
diff --git a/daemon/fw/multicast-strategy.cpp b/daemon/fw/multicast-strategy.cpp
index d053482..9543e6f 100644
--- a/daemon/fw/multicast-strategy.cpp
+++ b/daemon/fw/multicast-strategy.cpp
@@ -34,9 +34,15 @@
NFD_LOG_INIT("MulticastStrategy");
+const time::milliseconds MulticastStrategy::RETX_SUPPRESSION_INITIAL(10);
+const time::milliseconds MulticastStrategy::RETX_SUPPRESSION_MAX(250);
+
MulticastStrategy::MulticastStrategy(Forwarder& forwarder, const Name& name)
: Strategy(forwarder)
, ProcessNackTraits(this)
+ , m_retxSuppression(RETX_SUPPRESSION_INITIAL,
+ RetxSuppressionExponential::DEFAULT_MULTIPLIER,
+ RETX_SUPPRESSION_MAX)
{
ParsedInstanceName parsed = parseInstanceName(name);
if (!parsed.parameters.empty()) {
@@ -52,7 +58,7 @@
const Name&
MulticastStrategy::getStrategyName()
{
- static Name strategyName("/localhost/nfd/strategy/multicast/%FD%01");
+ static Name strategyName("/localhost/nfd/strategy/multicast/%FD%02");
return strategyName;
}
@@ -60,8 +66,14 @@
MulticastStrategy::afterReceiveInterest(const Face& inFace, const Interest& interest,
const shared_ptr<pit::Entry>& pitEntry)
{
- if (hasPendingOutRecords(*pitEntry)) {
- // not a new Interest, don't forward
+ // Should the Interest be suppressed?
+ RetxSuppression::Result suppressResult = m_retxSuppression.decide(inFace, interest, *pitEntry);
+ switch (suppressResult) {
+ case RetxSuppression::NEW:
+ case RetxSuppression::FORWARD:
+ break;
+ case RetxSuppression::SUPPRESS:
+ NFD_LOG_DEBUG(interest << " from=" << inFace.getId() << " suppressed");
return;
}
diff --git a/daemon/fw/multicast-strategy.hpp b/daemon/fw/multicast-strategy.hpp
index 7e77d72..d75e3a1 100644
--- a/daemon/fw/multicast-strategy.hpp
+++ b/daemon/fw/multicast-strategy.hpp
@@ -28,6 +28,7 @@
#include "strategy.hpp"
#include "process-nack-traits.hpp"
+#include "retx-suppression-exponential.hpp"
namespace nfd {
namespace fw {
@@ -54,6 +55,11 @@
private:
friend ProcessNackTraits<MulticastStrategy>;
+ RetxSuppressionExponential m_retxSuppression;
+
+PUBLIC_WITH_TESTS_ELSE_PRIVATE:
+ static const time::milliseconds RETX_SUPPRESSION_INITIAL;
+ static const time::milliseconds RETX_SUPPRESSION_MAX;
};
} // namespace fw