core: make SizeCounter use pointer instead of reference
Restore virtual inheritance of GenericLinkServiceCounters in
GenericLinkService
refs #3941
Change-Id: I368e4694fee7bc97173fddfc81d0c679da0d6eed
diff --git a/daemon/face/generic-link-service.cpp b/daemon/face/generic-link-service.cpp
index 9d1d0fc..20c1cb8 100644
--- a/daemon/face/generic-link-service.cpp
+++ b/daemon/face/generic-link-service.cpp
@@ -31,11 +31,6 @@
NFD_LOG_INIT("GenericLinkService");
-GenericLinkServiceCounters::GenericLinkServiceCounters(const LpReassembler& reassembler)
- : nReassembling(reassembler)
-{
-}
-
GenericLinkService::Options::Options()
: allowLocalFields(false)
, allowFragmentation(false)
@@ -44,14 +39,14 @@
}
GenericLinkService::GenericLinkService(const GenericLinkService::Options& options)
- : GenericLinkServiceCounters(m_reassembler)
- , m_options(options)
+ : m_options(options)
, m_fragmenter(m_options.fragmenterOptions, this)
, m_reassembler(m_options.reassemblerOptions, this)
, m_reliability(m_options.reliabilityOptions, this)
, m_lastSeqNo(-2)
{
m_reassembler.beforeTimeout.connect(bind([this] { ++this->nReassemblyTimeouts; }));
+ nReassembling.observe(&m_reassembler);
}
void
diff --git a/daemon/face/generic-link-service.hpp b/daemon/face/generic-link-service.hpp
index 8a8622f..4c347d6 100644
--- a/daemon/face/generic-link-service.hpp
+++ b/daemon/face/generic-link-service.hpp
@@ -41,9 +41,6 @@
class GenericLinkServiceCounters : public virtual LinkService::Counters
{
public:
- explicit
- GenericLinkServiceCounters(const LpReassembler& reassembler);
-
/** \brief count of failed fragmentations
*/
PacketCounter nFragmentationErrors;
@@ -87,10 +84,9 @@
/** \brief GenericLinkService is a LinkService that implements the NDNLPv2 protocol
* \sa https://redmine.named-data.net/projects/nfd/wiki/NDNLPv2
- * \todo #3941 declare GenericLinkServiceCounters as virtual inheritance
*/
class GenericLinkService : public LinkService
- , protected GenericLinkServiceCounters
+ , protected virtual GenericLinkServiceCounters
{
public:
/** \brief Options that control the behavior of GenericLinkService