face: override Transport::beforeChangePersistency in all subclasses
This commit also adds the final specifier to some Transport
subclasses in order to improve code generation.
Change-Id: If2979fa1614476a98019ba79cee3961663fc447b
Refs: #3318
diff --git a/daemon/face/transport.cpp b/daemon/face/transport.cpp
index 0c4f4ee..1b7832e 100644
--- a/daemon/face/transport.cpp
+++ b/daemon/face/transport.cpp
@@ -128,6 +128,25 @@
}
void
+Transport::setPersistency(ndn::nfd::FacePersistency newPersistency)
+{
+ if (m_persistency == newPersistency) {
+ return;
+ }
+
+ if (newPersistency == ndn::nfd::FACE_PERSISTENCY_NONE) {
+ throw std::runtime_error("invalid persistency transition");
+ }
+
+ if (m_persistency != ndn::nfd::FACE_PERSISTENCY_NONE) {
+ this->beforeChangePersistency(newPersistency);
+ NFD_LOG_FACE_DEBUG("setPersistency " << m_persistency << " -> " << newPersistency);
+ }
+
+ m_persistency = newPersistency;
+}
+
+void
Transport::setState(TransportState newState)
{
if (m_state == newState) {