Browse Source

update I2NP header after all fragments received

pull/1752/head
orignal 3 years ago
parent
commit
db5e90787c
  1. 3
      libi2pd/SSU2.cpp

3
libi2pd/SSU2.cpp

@ -842,7 +842,6 @@ namespace transport
// same format as I2NP message block // same format as I2NP message block
msg->len = msg->offset + len + 7; msg->len = msg->offset + len + 7;
memcpy (msg->GetNTCP2Header (), buf, len); memcpy (msg->GetNTCP2Header (), buf, len);
msg->FromNTCP2 ();
std::shared_ptr<SSU2IncompleteMessage> m; std::shared_ptr<SSU2IncompleteMessage> m;
bool found = false; bool found = false;
auto it = m_IncompleteMessages.find (msgID); auto it = m_IncompleteMessages.find (msgID);
@ -862,6 +861,7 @@ namespace transport
if (found && ConcatOutOfSequenceFragments (m)) if (found && ConcatOutOfSequenceFragments (m))
{ {
// we have all follow-on fragments already // we have all follow-on fragments already
m->msg->FromNTCP2 ();
m_Handler.PutNextMessage (std::move (m->msg)); m_Handler.PutNextMessage (std::move (m->msg));
m_IncompleteMessages.erase (it); m_IncompleteMessages.erase (it);
} }
@ -882,6 +882,7 @@ namespace transport
it->second->msg->Concat (buf + 5, len - 5); it->second->msg->Concat (buf + 5, len - 5);
if (isLast) if (isLast)
{ {
it->second->msg->FromNTCP2 ();
m_Handler.PutNextMessage (std::move (it->second->msg)); m_Handler.PutNextMessage (std::move (it->second->msg));
m_IncompleteMessages.erase (it); m_IncompleteMessages.erase (it);
} }

Loading…
Cancel
Save