pingserver: allow setting payload size
refs #2699
Change-Id: I45181845e196ea390f0b6b39165097df510f9116
diff --git a/tools/ping/server/ping-server.cpp b/tools/ping/server/ping-server.cpp
index e75f649..e0d0beb 100644
--- a/tools/ping/server/ping-server.cpp
+++ b/tools/ping/server/ping-server.cpp
@@ -32,6 +32,9 @@
, m_nPings(0)
, m_face(face)
{
+ shared_ptr<Buffer> b = make_shared<Buffer>();
+ b->assign(m_options.payloadSize, 'a');
+ m_payload = Block(tlv::Content, b);
}
void
@@ -60,11 +63,9 @@
afterReceive(interestName);
- char responseContent[] = "NDN TLV Ping Response";
shared_ptr<Data> data = make_shared<Data>(interestName);
data->setFreshnessPeriod(m_options.freshnessPeriod);
- data->setContent(reinterpret_cast<const uint8_t*>(responseContent),
- sizeof(responseContent));
+ data->setContent(m_payload);
m_keyChain.sign(*data);
m_face.put(*data);