face: cleanup log messages in all faces and print fail reason
Change-Id: I405198b375a0317663d29810ee87922a19edccaa
Refs: #2450
diff --git a/daemon/fw/face-table.cpp b/daemon/fw/face-table.cpp
index 1848380..0f78f74 100644
--- a/daemon/fw/face-table.cpp
+++ b/daemon/fw/face-table.cpp
@@ -87,21 +87,24 @@
face->onReceiveInterest.connect(bind(&Forwarder::onInterest, &m_forwarder, ref(*face), _1));
face->onReceiveData.connect(bind(&Forwarder::onData, &m_forwarder, ref(*face), _1));
- face->onFail.connectSingleShot(bind(&FaceTable::remove, this, face));
+ face->onFail.connectSingleShot(bind(&FaceTable::remove, this, face, _1));
this->onAdd(face);
}
void
-FaceTable::remove(shared_ptr<Face> face)
+FaceTable::remove(shared_ptr<Face> face, const std::string& reason)
{
this->onRemove(face);
FaceId faceId = face->getId();
m_faces.erase(faceId);
face->setId(INVALID_FACEID);
- NFD_LOG_INFO("Removed face id=" << faceId << " remote=" << face->getRemoteUri() <<
- " local=" << face->getLocalUri());
+
+ NFD_LOG_INFO("Removed face id=" << faceId <<
+ " remote=" << face->getRemoteUri() <<
+ " local=" << face->getLocalUri() <<
+ " (" << reason << ")");
m_forwarder.getFib().removeNextHopFromAllEntries(face);
}
diff --git a/daemon/fw/face-table.hpp b/daemon/fw/face-table.hpp
index 435999e..67c7932 100644
--- a/daemon/fw/face-table.hpp
+++ b/daemon/fw/face-table.hpp
@@ -87,10 +87,10 @@
void
addImpl(shared_ptr<Face> face, FaceId faceId);
- // remove is private because it's a subscriber of face.onFail event.
- // face->close() closes a face and triggers .remove(face)
+ // remove is private because it's a handler of face.onFail signal.
+ // face->close() closes the face and triggers .remove()
void
- remove(shared_ptr<Face> face);
+ remove(shared_ptr<Face> face, const std::string& reason);
ForwardRange
getForwardRange() const;