face: refactor handling of LinkType face trait
This commit also includes some cleanups, fixes EthernetFace to report
the correct LinkType, and makes (get|set)Description non-virtual.
Change-Id: I53909d7bfa02a92641b523a766359413c966aae6
Refs: #2563
diff --git a/daemon/face/udp-face.cpp b/daemon/face/udp-face.cpp
index 27c78b3..7206984 100644
--- a/daemon/face/udp-face.cpp
+++ b/daemon/face/udp-face.cpp
@@ -38,14 +38,13 @@
NFD_LOG_INCLASS_TEMPLATE_SPECIALIZATION_DEFINE(DatagramFace, UdpFace::protocol, "UdpFace");
UdpFace::UdpFace(const shared_ptr<UdpFace::protocol::socket>& socket,
- bool isOnDemand,
- const time::seconds& idleTimeout)
- : DatagramFace<protocol>(FaceUri(socket->remote_endpoint()),
- FaceUri(socket->local_endpoint()),
- socket, isOnDemand)
+ bool isOnDemand, const time::seconds& idleTimeout)
+ : DatagramFace(FaceUri(socket->remote_endpoint()), FaceUri(socket->local_endpoint()), socket)
, m_idleTimeout(idleTimeout)
, m_lastIdleCheck(time::steady_clock::now())
{
+ this->setOnDemand(isOnDemand);
+
#ifdef __linux__
//
// By default, Linux does path MTU discovery on IPv4 sockets,
@@ -67,7 +66,7 @@
}
#endif
- if (isOnDemand && m_idleTimeout > time::seconds::zero()) {
+ if (this->isOnDemand() && m_idleTimeout > time::seconds::zero()) {
m_closeIfIdleEvent = scheduler::schedule(m_idleTimeout,
bind(&UdpFace::closeIfIdle, this));
}