face: copy also the link type in copyStatusTo
Change-Id: I3787210328f326fd788e7f0f3e23493e4dfa9ddd
Refs: #2563
diff --git a/daemon/face/face.cpp b/daemon/face/face.cpp
index 2b107a7..06bae23 100644
--- a/daemon/face/face.cpp
+++ b/daemon/face/face.cpp
@@ -128,22 +128,14 @@
Face::copyStatusTo(FaceTraits& traits) const
{
traits.setFaceId(getId())
- .setRemoteUri(getRemoteUri().toString())
- .setLocalUri(getLocalUri().toString());
-
- if (isLocal()) {
- traits.setFaceScope(ndn::nfd::FACE_SCOPE_LOCAL);
- }
- else {
- traits.setFaceScope(ndn::nfd::FACE_SCOPE_NON_LOCAL);
- }
-
- if (isOnDemand()) {
- traits.setFacePersistency(ndn::nfd::FACE_PERSISTENCY_ON_DEMAND);
- }
- else {
- traits.setFacePersistency(ndn::nfd::FACE_PERSISTENCY_PERSISTENT);
- }
+ .setRemoteUri(getRemoteUri().toString())
+ .setLocalUri(getLocalUri().toString())
+ .setFaceScope(isLocal() ? ndn::nfd::FACE_SCOPE_LOCAL
+ : ndn::nfd::FACE_SCOPE_NON_LOCAL)
+ .setFacePersistency(isOnDemand() ? ndn::nfd::FACE_PERSISTENCY_ON_DEMAND
+ : ndn::nfd::FACE_PERSISTENCY_PERSISTENT)
+ .setLinkType(isMultiAccess() ? ndn::nfd::LINK_TYPE_MULTI_ACCESS
+ : ndn::nfd::LINK_TYPE_POINT_TO_POINT);
}
template void
@@ -156,11 +148,11 @@
Face::getFaceStatus() const
{
ndn::nfd::FaceStatus status;
- copyStatusTo(status);
+ copyStatusTo(status);
this->getCounters().copyTo(status);
return status;
}
-} //namespace nfd
+} // namespace nfd
diff --git a/daemon/face/udp-face.cpp b/daemon/face/udp-face.cpp
index 8962f0d..27c78b3 100644
--- a/daemon/face/udp-face.cpp
+++ b/daemon/face/udp-face.cpp
@@ -81,20 +81,19 @@
ndn::nfd::FaceStatus
UdpFace::getFaceStatus() const
{
- auto status = Face::getFaceStatus();
+ auto status = DatagramFace::getFaceStatus();
if (isOnDemand()) {
- time::milliseconds left = m_idleTimeout - time::duration_cast<time::milliseconds>(
- time::steady_clock::now() - m_lastIdleCheck);
+ time::milliseconds left = m_idleTimeout;
+ left -= time::duration_cast<time::milliseconds>(time::steady_clock::now() - m_lastIdleCheck);
+
if (left < time::milliseconds::zero())
left = time::milliseconds::zero();
- if (hasBeenUsedRecently()) {
- status.setExpirationPeriod(left + m_idleTimeout);
- }
- else {
- status.setExpirationPeriod(left);
- }
+ if (hasBeenUsedRecently())
+ left += m_idleTimeout;
+
+ status.setExpirationPeriod(left);
}
return status;