32 #include <netinet/in.h> 33 #include <sys/socket.h> 40 "UnicastUdpTransport");
44 time::nanoseconds idleTimeout)
46 , m_idleTimeout(idleTimeout)
48 this->setLocalUri(
FaceUri(m_socket.local_endpoint()));
49 this->setRemoteUri(
FaceUri(m_socket.remote_endpoint()));
51 this->setPersistency(persistency);
70 const int value = IP_PMTUDISC_DONT;
71 if (::setsockopt(m_socket.native_handle(), IPPROTO_IP,
72 IP_MTU_DISCOVER, &value,
sizeof(value)) < 0) {
73 NFD_LOG_FACE_WARN(
"Failed to disable path MTU discovery: " << std::strerror(errno));
78 m_idleTimeout > time::nanoseconds::zero()) {
79 scheduleClosureWhenIdle();
87 m_idleTimeout > time::nanoseconds::zero()) {
88 scheduleClosureWhenIdle();
91 m_closeIfIdleEvent.cancel();
92 setExpirationTime(time::steady_clock::TimePoint::max());
97 UnicastUdpTransport::scheduleClosureWhenIdle()
100 if (!hasBeenUsedRecently()) {
106 scheduleClosureWhenIdle();
static time_point now() noexcept
represents the underlying protocol and address used by a Face
Implements Transport for datagram-based protocols.
#define NFD_LOG_FACE_INFO(msg)
Log a message at INFO level.
Copyright (c) 2011-2015 Regents of the University of California.
#define NFD_LOG_INCLASS_TEMPLATE_SPECIALIZATION_DEFINE(cls, specialization, name)
EventId schedule(const time::nanoseconds &after, const Scheduler::Event &event)
schedule an event
ssize_t computeMtu(const boost::asio::ip::udp::endpoint &localEndpoint)
computes maximum payload size in a UDP packet
#define NFD_LOG_FACE_WARN(msg)
Log a message at WARN level.