face: use std::array in UdpChannel
Change-Id: I9dc209ef471601f73ae85a36a317d7abf7c1849d
diff --git a/daemon/face/udp-channel.cpp b/daemon/face/udp-channel.cpp
index e1bcd35..dfbfefc 100644
--- a/daemon/face/udp-channel.cpp
+++ b/daemon/face/udp-channel.cpp
@@ -91,8 +91,7 @@
UdpChannel::waitForNewPeer(const FaceCreatedCallback& onFaceCreated,
const FaceCreationFailedCallback& onReceiveFailed)
{
- m_socket.async_receive_from(boost::asio::buffer(m_inputBuffer, ndn::MAX_NDN_PACKET_SIZE),
- m_remoteEndpoint,
+ m_socket.async_receive_from(boost::asio::buffer(m_receiveBuffer), m_remoteEndpoint,
bind(&UdpChannel::handleNewPeer, this,
boost::asio::placeholders::error,
boost::asio::placeholders::bytes_transferred,
@@ -133,7 +132,7 @@
// dispatch the datagram to the face for processing
auto* transport = static_cast<UnicastUdpTransport*>(face->getTransport());
- transport->receiveDatagram(m_inputBuffer, nBytesReceived, error);
+ transport->receiveDatagram(m_receiveBuffer.data(), nBytesReceived, error);
waitForNewPeer(onFaceCreated, onReceiveFailed);
}
diff --git a/daemon/face/udp-channel.hpp b/daemon/face/udp-channel.hpp
index c4d261e..403afac 100644
--- a/daemon/face/udp-channel.hpp
+++ b/daemon/face/udp-channel.hpp
@@ -29,6 +29,8 @@
#include "channel.hpp"
#include "udp-protocol.hpp"
+#include <array>
+
namespace nfd {
namespace face {
@@ -112,7 +114,7 @@
udp::Endpoint m_remoteEndpoint; ///< The latest peer that started communicating with us
boost::asio::ip::udp::socket m_socket; ///< Socket used to "accept" new peers
std::map<udp::Endpoint, shared_ptr<Face>> m_channelFaces;
- uint8_t m_inputBuffer[ndn::MAX_NDN_PACKET_SIZE];
+ std::array<uint8_t, ndn::MAX_NDN_PACKET_SIZE> m_receiveBuffer;
time::seconds m_idleFaceTimeout; ///< Timeout for automatic closure of idle on-demand faces
};