32 #include <netinet/in.h> 33 #include <sys/socket.h> 42 const time::seconds& idleTimeout)
44 , m_idleTimeout(idleTimeout)
45 , m_lastIdleCheck(
time::steady_clock::now())
62 const int value = IP_PMTUDISC_DONT;
63 if (::setsockopt(
m_socket.native_handle(), IPPROTO_IP,
64 IP_MTU_DISCOVER, &value,
sizeof(value)) < 0) {
65 NFD_LOG_FACE_WARN(
"Failed to disable path MTU discovery: " << std::strerror(errno));
80 time::milliseconds left = m_idleTimeout;
83 if (left < time::milliseconds::zero())
84 left = time::milliseconds::zero();
87 left += m_idleTimeout;
89 status.setExpirationPeriod(left);
96 UdpFace::closeIfIdle()
115 m_closeIfIdleEvent =
scheduler::schedule(m_idleTimeout, bind(&UdpFace::closeIfIdle,
this));
static time_point now() noexcept
represents the underlying protocol and address used by a Face
void setPersistency(ndn::nfd::FacePersistency persistency)
ndn::nfd::FaceStatus getFaceStatus() const 1
virtual ndn::nfd::FaceStatus getFaceStatus() const
ndn::nfd::FacePersistency getPersistency() const
Get the persistency setting.
bool hasBeenUsedRecently() const
#define NFD_LOG_FACE_INFO(msg)
Log a message at INFO level.
Copyright (c) 2011-2015 Regents of the University of California.
boost::asio::ip::udp protocol
EventId schedule(const time::nanoseconds &after, const std::function< void()> &event)
schedule an event
UdpFace(const FaceUri &remoteUri, const FaceUri &localUri, protocol::socket socket, ndn::nfd::FacePersistency persistency, const time::seconds &idleTimeout)
#define NFD_LOG_FACE_WARN(msg)
Log a message at WARN level.
protocol::socket m_socket
void resetRecentUsage()
Set m_hasBeenUsedRecently to false.