face: Moving idle UdpFace closing logic to UdpFace class
Change-Id: Ia7310fa18681f17d93c8214ce744da909fea7022
Refs: #1686
diff --git a/daemon/face/udp-face.hpp b/daemon/face/udp-face.hpp
index ec11682..2751517 100644
--- a/daemon/face/udp-face.hpp
+++ b/daemon/face/udp-face.hpp
@@ -26,6 +26,7 @@
#define NFD_DAEMON_FACE_UDP_FACE_HPP
#include "datagram-face.hpp"
+#include "core/scheduler.hpp"
namespace nfd {
@@ -37,7 +38,11 @@
{
public:
UdpFace(const shared_ptr<protocol::socket>& socket,
- bool isOnDemand);
+ bool isOnDemand,
+ const time::seconds& idleTimeout);
+
+ virtual
+ ~UdpFace();
/**
* \brief Manages the first datagram received by the UdpChannel socket set on listening
@@ -46,6 +51,18 @@
handleFirstReceive(const uint8_t* buffer,
std::size_t nBytesReceived,
const boost::system::error_code& error);
+
+ virtual ndn::nfd::FaceStatus
+ getFaceStatus() const;
+
+private:
+ void
+ closeIfIdle();
+
+private:
+ EventId m_closeIfIdleEvent;
+ time::seconds m_idleTimeout;
+ time::steady_clock::TimePoint m_lastIdleCheck;
};
} // namespace nfd