face: remove pointless method UdpFace::handleFirstReceive
Simply call DatagramFace::receiveDatagram directly. Change-Id: Icec976fb9f4a008d08ece56c28ac652ea615bc76
This commit is contained in:
1 parent
40c61f77cc
commit
a75305892c
6 files changed
+16
-47
No files matched your search
@@ -64,12 +64,9 @@ public:
|
||||
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 @@ public:
|
||||
|
||||
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);
|
||||
|
||||
@@ -55,8 +55,7 @@ MulticastUdpFace::sendBlock(const Block& block)
|
||||
{
|
||||
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
|
||||
|
||||
@@ -36,8 +36,8 @@ namespace nfd {
|
||||
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 @@ public:
|
||||
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);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -236,8 +236,8 @@ UdpChannel::newPeer(const boost::system::error_code& error,
|
||||
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,
|
||||
|
||||
@@ -76,28 +76,6 @@ UdpFace::~UdpFace()
|
||||
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
|
||||
{
|
||||
|
||||
@@ -44,14 +44,6 @@ public:
|
||||
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;
|
||||
|
||||
|
||||
Reference in new issue
Block a user