fw: pass parameters to Strategy subclass constructors
refs #3868
Change-Id: I1a09e7353c047d548065c4ed669d1f7993676428
diff --git a/daemon/fw/client-control-strategy.cpp b/daemon/fw/client-control-strategy.cpp
index edb98cd..8c99db2 100644
--- a/daemon/fw/client-control-strategy.cpp
+++ b/daemon/fw/client-control-strategy.cpp
@@ -33,8 +33,16 @@
NFD_REGISTER_STRATEGY(ClientControlStrategy);
ClientControlStrategy::ClientControlStrategy(Forwarder& forwarder, const Name& name)
- : BestRouteStrategy(forwarder, name)
+ : BestRouteStrategyBase(forwarder)
{
+ ParsedInstanceName parsed = parseInstanceName(name);
+ if (!parsed.parameters.empty()) {
+ BOOST_THROW_EXCEPTION(std::invalid_argument("ClientControlStrategy does not accept parameters"));
+ }
+ this->setInstanceName(makeInstanceName(name, getStrategyName()));
+
+ NFD_LOG_WARN("NextHopFaceId field is honored universally and "
+ "it's unnecessary to set client-control strategy.");
}
const Name&
@@ -44,18 +52,5 @@
return strategyName;
}
-void
-ClientControlStrategy::afterReceiveInterest(const Face& inFace, const Interest& interest,
- const shared_ptr<pit::Entry>& pitEntry)
-{
- if (m_isFirstUse) {
- NFD_LOG_WARN("NextHopFaceId field is honored universally and "
- "it's unnecessary to set client-control strategy.");
- m_isFirstUse = false;
- }
-
- this->BestRouteStrategy::afterReceiveInterest(inFace, interest, pitEntry);
-}
-
} // namespace fw
} // namespace nfd