fw: Add unsolicited data forwarder counter
Change-Id: I47650e270f0305e34fb4ec9713802671ac96a4cb
diff --git a/daemon/fw/forwarder-counters.hpp b/daemon/fw/forwarder-counters.hpp
index f526b86..d6b2fde 100644
--- a/daemon/fw/forwarder-counters.hpp
+++ b/daemon/fw/forwarder-counters.hpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2019, Regents of the University of California,
+ * Copyright (c) 2014-2020, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -30,7 +30,7 @@
namespace nfd {
-/** \brief counters provided by Forwarder
+/** \brief Counters provided by Forwarder
*/
class ForwarderCounters
{
@@ -41,8 +41,10 @@
PacketCounter nOutData;
PacketCounter nInNacks;
PacketCounter nOutNacks;
+
PacketCounter nSatisfiedInterests;
PacketCounter nUnsatisfiedInterests;
+ PacketCounter nUnsolicitedData;
PacketCounter nCsHits;
PacketCounter nCsMisses;
diff --git a/daemon/fw/forwarder.cpp b/daemon/fw/forwarder.cpp
index 1bc0acc..67b8f52 100644
--- a/daemon/fw/forwarder.cpp
+++ b/daemon/fw/forwarder.cpp
@@ -387,13 +387,14 @@
Forwarder::onDataUnsolicited(const FaceEndpoint& ingress, const Data& data)
{
// accept to cache?
- fw::UnsolicitedDataDecision decision = m_unsolicitedDataPolicy->decide(ingress.face, data);
+ auto decision = m_unsolicitedDataPolicy->decide(ingress.face, data);
if (decision == fw::UnsolicitedDataDecision::CACHE) {
// CS insert
m_cs.insert(data, true);
}
NFD_LOG_DEBUG("onDataUnsolicited in=" << ingress << " data=" << data.getName() << " decision=" << decision);
+ ++m_counters.nUnsolicitedData;
}
void