face: remove pointless method UdpFace::handleFirstReceive
Simply call DatagramFace::receiveDatagram directly.
Change-Id: Icec976fb9f4a008d08ece56c28ac652ea615bc76
diff --git a/daemon/face/datagram-face.hpp b/daemon/face/datagram-face.hpp
index bae4fb2..6f111e7 100644
--- a/daemon/face/datagram-face.hpp
+++ b/daemon/face/datagram-face.hpp
@@ -64,12 +64,9 @@
close();
void
- handleSend(const boost::system::error_code& error,
- const Block& wire);
-
- void
- handleReceive(const boost::system::error_code& error,
- size_t nBytesReceived);
+ receiveDatagram(const uint8_t* buffer,
+ size_t nBytesReceived,
+ const boost::system::error_code& error);
/**
* \brief Set m_hasBeenUsedRecently to false
@@ -85,9 +82,12 @@
protected:
void
- receiveDatagram(const uint8_t* buffer,
- size_t nBytesReceived,
- const boost::system::error_code& error);
+ handleSend(const boost::system::error_code& error,
+ const Block& wire);
+
+ void
+ handleReceive(const boost::system::error_code& error,
+ size_t nBytesReceived);
void
keepFaceAliveUntilAllHandlersExecuted(const shared_ptr<Face>& face);
diff --git a/daemon/face/multicast-udp-face.cpp b/daemon/face/multicast-udp-face.cpp
index c3d7e95..a69b1c2 100644
--- a/daemon/face/multicast-udp-face.cpp
+++ b/daemon/face/multicast-udp-face.cpp
@@ -55,8 +55,7 @@
{
m_sendSocket->async_send_to(boost::asio::buffer(block.wire(), block.size()),
m_multicastGroup,
- bind(&DatagramFace<protocol, Multicast>::handleSend,
- this, _1, block));
+ bind(&MulticastUdpFace::handleSend, this, _1, block));
}
void
diff --git a/daemon/face/tcp-face.hpp b/daemon/face/tcp-face.hpp
index a522ac4..3eddde1 100644
--- a/daemon/face/tcp-face.hpp
+++ b/daemon/face/tcp-face.hpp
@@ -36,8 +36,8 @@
class TcpFace : public StreamFace<boost::asio::ip::tcp>
{
public:
- explicit
- TcpFace(const shared_ptr<protocol::socket>& socket, bool isOnDemand);
+ TcpFace(const shared_ptr<protocol::socket>& socket,
+ bool isOnDemand);
};
//
@@ -50,8 +50,8 @@
class TcpLocalFace : public StreamFace<boost::asio::ip::tcp, LocalFace>
{
public:
- explicit
- TcpLocalFace(const shared_ptr<protocol::socket>& socket, bool isOnDemand);
+ TcpLocalFace(const shared_ptr<protocol::socket>& socket,
+ bool isOnDemand);
};
diff --git a/daemon/face/udp-channel.cpp b/daemon/face/udp-channel.cpp
index b01d699..8d1e780 100644
--- a/daemon/face/udp-channel.cpp
+++ b/daemon/face/udp-channel.cpp
@@ -236,8 +236,8 @@
true);
}
- //Passing the message to the correspondent face
- face->handleFirstReceive(m_inputBuffer, nBytesReceived, error);
+ // dispatch the datagram to the face for processing
+ face->receiveDatagram(m_inputBuffer, nBytesReceived, error);
m_socket->async_receive_from(boost::asio::buffer(m_inputBuffer, MAX_NDN_PACKET_SIZE),
m_newRemoteEndpoint,
diff --git a/daemon/face/udp-face.cpp b/daemon/face/udp-face.cpp
index 843d48f..7464c3f 100644
--- a/daemon/face/udp-face.cpp
+++ b/daemon/face/udp-face.cpp
@@ -76,28 +76,6 @@
scheduler::cancel(m_closeIfIdleEvent);
}
-void
-UdpFace::handleFirstReceive(const uint8_t* buffer,
- std::size_t nBytesReceived,
- const boost::system::error_code& error)
-{
- NFD_LOG_TRACE("handleFirstReceive");
-
- // Checking if the received message size is too big.
- // This check is redundant, since in the actual implementation
- // a packet cannot be larger than MAX_NDN_PACKET_SIZE.
- if (!error && (nBytesReceived > MAX_NDN_PACKET_SIZE))
- {
- NFD_LOG_WARN("[id:" << this->getId()
- << ",endpoint:" << m_socket->local_endpoint()
- << "] Received message too big. Maximum size is "
- << MAX_NDN_PACKET_SIZE );
- return;
- }
-
- receiveDatagram(buffer, nBytesReceived, error);
-}
-
ndn::nfd::FaceStatus
UdpFace::getFaceStatus() const
{
diff --git a/daemon/face/udp-face.hpp b/daemon/face/udp-face.hpp
index 2751517..49c374b 100644
--- a/daemon/face/udp-face.hpp
+++ b/daemon/face/udp-face.hpp
@@ -44,14 +44,6 @@
virtual
~UdpFace();
- /**
- * \brief Manages the first datagram received by the UdpChannel socket set on listening
- */
- void
- handleFirstReceive(const uint8_t* buffer,
- std::size_t nBytesReceived,
- const boost::system::error_code& error);
-
virtual ndn::nfd::FaceStatus
getFaceStatus() const;