fw: deprecate ClientControlStrategy
It becomes unnecessary because NextHopFaceId is honored universally.
refs #3783
Change-Id: I4c0c48f10ae58aa2603998f195f43d54e81bfcf2
diff --git a/daemon/fw/client-control-strategy.cpp b/daemon/fw/client-control-strategy.cpp
index 0b1c5f5..37460f9 100644
--- a/daemon/fw/client-control-strategy.cpp
+++ b/daemon/fw/client-control-strategy.cpp
@@ -25,15 +25,13 @@
#include "client-control-strategy.hpp"
#include "core/logger.hpp"
-#include <ndn-cxx/lp/tags.hpp>
namespace nfd {
namespace fw {
NFD_LOG_INIT("ClientControlStrategy");
-const Name
-ClientControlStrategy::STRATEGY_NAME("ndn:/localhost/nfd/strategy/client-control/%FD%01");
+const Name ClientControlStrategy::STRATEGY_NAME("ndn:/localhost/nfd/strategy/client-control/%FD%02");
NFD_REGISTER_STRATEGY(ClientControlStrategy);
ClientControlStrategy::ClientControlStrategy(Forwarder& forwarder, const Name& name)
@@ -45,24 +43,13 @@
ClientControlStrategy::afterReceiveInterest(const Face& inFace, const Interest& interest,
const shared_ptr<pit::Entry>& pitEntry)
{
- shared_ptr<lp::NextHopFaceIdTag> tag = interest.getTag<lp::NextHopFaceIdTag>();
- if (tag == nullptr) {
- this->BestRouteStrategy::afterReceiveInterest(inFace, interest, pitEntry);
- return;
+ if (m_isFirstUse) {
+ NFD_LOG_WARN("NextHopFaceId field is honored universally and "
+ "it's unnecessary to set client-control strategy.");
+ m_isFirstUse = false;
}
- FaceId outFaceId = static_cast<FaceId>(*tag);
- Face* outFace = this->getFace(outFaceId);
- if (outFace == nullptr) {
- // If outFace doesn't exist, it's better to reject the Interest
- // than to use BestRouteStrategy.
- NFD_LOG_WARN("Interest " << interest.getName() <<
- " NextHopFaceId=" << outFaceId << " non-existent face");
- this->rejectPendingInterest(pitEntry);
- return;
- }
-
- this->sendInterest(pitEntry, *outFace);
+ this->BestRouteStrategy::afterReceiveInterest(inFace, interest, pitEntry);
}
} // namespace fw
diff --git a/daemon/fw/client-control-strategy.hpp b/daemon/fw/client-control-strategy.hpp
index 68b4441..13ffd81 100644
--- a/daemon/fw/client-control-strategy.hpp
+++ b/daemon/fw/client-control-strategy.hpp
@@ -31,11 +31,8 @@
namespace nfd {
namespace fw {
-/** \brief a forwarding strategy controlled by client application
- *
- * The consumer may specify the nexthop for an Interest in NDNLPv2 NextHopFaceId field.
- * If NextHopFaceId field is omitted, the Interest is forwarded to
- * the FIB nexthop with lowest routing cost.
+/** \brief identical to BestRouteStrategy v1, for backwards compatibility
+ * \deprecated NextHopFaceId field is honored universally and it's unnecessary to set this strategy
*/
class ClientControlStrategy : public BestRouteStrategy
{
@@ -49,6 +46,9 @@
public:
static const Name STRATEGY_NAME;
+
+private:
+ bool m_isFirstUse = true;
};
} // namespace fw