face: Transport::canChangePersistencyTo
Feasibility of transport persistency change can be checked with
Transport::canChangePersistencyTo before executing the actual change.
This enables management to verify persistency and other parameters
in a faces/update command before applying the updates.
Change-Id: Ia283f0daf678f47aad7b78b7e06dee4827f57cab
refs: #3232
diff --git a/daemon/face/unicast-udp-transport.cpp b/daemon/face/unicast-udp-transport.cpp
index b6ad19a..2860559 100644
--- a/daemon/face/unicast-udp-transport.cpp
+++ b/daemon/face/unicast-udp-transport.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/**
- * Copyright (c) 2014-2015, Regents of the University of California,
+ * Copyright (c) 2014-2017, Regents of the University of California,
* Arizona Board of Regents,
* Colorado State University,
* University Pierre & Marie Curie, Sorbonne University,
@@ -80,10 +80,16 @@
}
}
-void
-UnicastUdpTransport::beforeChangePersistency(ndn::nfd::FacePersistency newPersistency)
+bool
+UnicastUdpTransport::canChangePersistencyToImpl(ndn::nfd::FacePersistency newPersistency) const
{
- if (newPersistency == ndn::nfd::FACE_PERSISTENCY_ON_DEMAND &&
+ return true;
+}
+
+void
+UnicastUdpTransport::afterChangePersistency(ndn::nfd::FacePersistency oldPersistency)
+{
+ if (getPersistency() == ndn::nfd::FACE_PERSISTENCY_ON_DEMAND &&
m_idleTimeout > time::nanoseconds::zero()) {
scheduleClosureWhenIdle();
}