face: LinkService and Transport counters
refs #3177
Change-Id: Idc495c58c3103dae5f01a2b6ebbff47a2c4a5d2b
diff --git a/daemon/face/transport.cpp b/daemon/face/transport.cpp
index 1b7832e..0c4a4c6 100644
--- a/daemon/face/transport.cpp
+++ b/daemon/face/transport.cpp
@@ -65,7 +65,7 @@
, m_linkType(ndn::nfd::LINK_TYPE_NONE)
, m_mtu(MTU_INVALID)
, m_state(TransportState::UP)
- , m_counters(nullptr)
+ , m_oldCounters(nullptr)
{
}
@@ -81,7 +81,7 @@
m_face = &face;
m_service = &service;
- m_counters = &m_face->getMutableCounters();
+ m_oldCounters = &m_face->getMutableCounters();
}
void
@@ -109,8 +109,11 @@
return;
}
- // TODO#3177 increment LpPacket counter
- m_counters->getNOutBytes() += packet.packet.size();
+ if (state == TransportState::UP) {
+ ++this->nOutPackets;
+ this->nOutBytes += packet.packet.size();
+ m_oldCounters->getNOutBytes() += packet.packet.size();
+ }
this->doSend(std::move(packet));
}
@@ -121,8 +124,9 @@
BOOST_ASSERT(this->getMtu() == MTU_UNLIMITED ||
packet.packet.size() <= static_cast<size_t>(this->getMtu()));
- // TODO#3177 increment LpPacket counter
- m_counters->getNInBytes() += packet.packet.size();
+ ++this->nInPackets;
+ this->nInBytes += packet.packet.size();
+ m_oldCounters->getNInBytes() += packet.packet.size();
m_service->receivePacket(std::move(packet));
}