face: close idle Datagram faces
refs #1281
Change-Id: Ifc766964f653d3991b55d76361c8b9bbe5d630cf
diff --git a/daemon/face/udp-channel.hpp b/daemon/face/udp-channel.hpp
index 91b34cd..81e53ac 100644
--- a/daemon/face/udp-channel.hpp
+++ b/daemon/face/udp-channel.hpp
@@ -10,6 +10,7 @@
#include "channel.hpp"
#include "core/time.hpp"
#include "core/global-io.hpp"
+#include "core/scheduler.hpp"
#include "udp-face.hpp"
namespace nfd {
@@ -95,7 +96,8 @@
private:
shared_ptr<UdpFace>
createFace(const shared_ptr<boost::asio::ip::udp::socket>& socket,
- const FaceCreatedCallback& onFaceCreated);
+ const FaceCreatedCallback& onFaceCreated,
+ bool isPermanent);
void
afterFaceFailed(udp::Endpoint& endpoint);
@@ -114,6 +116,9 @@
const ConnectFailedCallback& onConnectFailed,
const shared_ptr<boost::asio::ip::udp::resolver>& resolver);
+ void
+ closeIdleFaces();
+
private:
udp::Endpoint m_localEndpoint;
@@ -146,6 +151,14 @@
* \brief If true, it means the function listen has already been called
*/
bool m_isListening;
+
+ /**
+ * \brief every time m_idleFaceTimeout expires all the idle (and not permanent)
+ * faces will be removed
+ */
+ time::Duration m_idleFaceTimeout;
+
+ EventId m_closeIdleFaceEvent;
};