face: NDNLP encoding change
FragIndex and FragCount fields are encoded as nonNegativeInteger.
refs #1283
Change-Id: I4654078c3bfd73c83ce06ce6a9cd97952a4f49f8
diff --git a/daemon/face/ndnlp-partial-message-store.cpp b/daemon/face/ndnlp-partial-message-store.cpp
index df8a285..74c109f 100644
--- a/daemon/face/ndnlp-partial-message-store.cpp
+++ b/daemon/face/ndnlp-partial-message-store.cpp
@@ -23,15 +23,15 @@
m_fragCount = fragCount;
m_payloads.resize(fragCount);
}
-
+
if (m_fragCount != fragCount || fragIndex >= m_fragCount) {
return false;
}
-
+
if (!m_payloads[fragIndex].empty()) { // duplicate
return false;
}
-
+
m_payloads[fragIndex] = payload;
++m_received;
m_totalLength += payload.value_size();
@@ -48,7 +48,7 @@
PartialMessage::reassemble()
{
BOOST_ASSERT(this->isComplete());
-
+
ndn::BufferPtr buffer = make_shared<ndn::Buffer>(m_totalLength);
uint8_t* buf = buffer->get();
for (std::vector<Block>::const_iterator it = m_payloads.begin();
@@ -57,7 +57,7 @@
memcpy(buf, payload.value(), payload.value_size());
buf += payload.value_size();
}
-
+
return Block(buffer);
}
@@ -80,14 +80,14 @@
this->onReceive(parsed.m_payload.blockFromValue());
return;
}
-
+
uint64_t messageIdentifier = parsed.m_seq - parsed.m_fragIndex;
shared_ptr<PartialMessage> pm = m_partialMessages[messageIdentifier];
if (!static_cast<bool>(pm)) {
m_partialMessages[messageIdentifier] = pm = make_shared<PartialMessage>();
}
this->scheduleCleanup(messageIdentifier, pm);
-
+
pm->add(parsed.m_fragIndex, parsed.m_fragCount, parsed.m_payload);
if (pm->isComplete()) {
this->onReceive(pm->reassemble());
@@ -111,7 +111,7 @@
if (it == m_partialMessages.end()) {
return;
}
-
+
m_scheduler.cancelEvent(it->second->m_expiry);
m_partialMessages.erase(it);
}