full-producer: segment sync data
refs: #4716
Change-Id: I6776bcfd2816c1c45548c3799c1ad3e52cb3cf18
diff --git a/src/detail/state.cpp b/src/detail/state.cpp
index d245c0b..09ee55e 100644
--- a/src/detail/state.cpp
+++ b/src/detail/state.cpp
@@ -72,9 +72,8 @@
State::wireDecode(const ndn::Block& wire)
{
auto blockType = wire.type();
-
- if (blockType != tlv::PSyncContent && blockType != ndn::tlv::Content) {
- BOOST_THROW_EXCEPTION(ndn::tlv::Error("Expected Content/PSyncContent Block, but Block is of a different type: #" +
+ if (blockType != tlv::PSyncContent) {
+ BOOST_THROW_EXCEPTION(ndn::tlv::Error("Expected PSyncContent Block, but Block is of type: #" +
ndn::to_string(blockType)));
return;
}
@@ -83,34 +82,13 @@
m_wire = wire;
- auto it = m_wire.elements_begin();
-
- if (it == m_wire.elements_end()) {
- return;
- }
-
- if (blockType == tlv::PSyncContent) {
- while(it != m_wire.elements_end()) {
- if (it->type() == ndn::tlv::Name) {
- m_content.emplace_back(*it);
- }
- else {
- BOOST_THROW_EXCEPTION(ndn::tlv::Error("Expected Name Block, but Block is of a different type: #" +
- ndn::to_string(it->type())));
- }
- ++it;
+ for (auto it = m_wire.elements_begin(); it != m_wire.elements_end(); ++it) {
+ if (it->type() == ndn::tlv::Name) {
+ m_content.emplace_back(*it);
}
- }
- else if (blockType == ndn::tlv::Content) {
- it->parse();
- for (auto val = it->elements_begin(); val != it->elements_end(); ++val) {
- if (val->type() == ndn::tlv::Name) {
- m_content.emplace_back(*val);
- }
- else {
- BOOST_THROW_EXCEPTION(ndn::tlv::Error("Expected Name Block, but Block is of a different type: #" +
- ndn::to_string(val->type())));
- }
+ else {
+ BOOST_THROW_EXCEPTION(ndn::tlv::Error("Expected Name Block, but Block is of type: #" +
+ ndn::to_string(it->type())));
}
}
}