|
|
@ -125,13 +125,8 @@ namespace tunnel |
|
|
|
if (fragmentNum == it->second.nextFragmentNum) |
|
|
|
if (fragmentNum == it->second.nextFragmentNum) |
|
|
|
{ |
|
|
|
{ |
|
|
|
I2NPMessage * incompleteMessage = it->second.data; |
|
|
|
I2NPMessage * incompleteMessage = it->second.data; |
|
|
|
if (incompleteMessage->len + size >= I2NP_MAX_MESSAGE_SIZE) |
|
|
|
if (incompleteMessage->len + size < I2NP_MAX_MESSAGE_SIZE) // check if messega is not too long
|
|
|
|
{ |
|
|
|
{ |
|
|
|
LogPrint ("Fragment ", fragmentNum, " of message ", msgID, "exceeds max I2NP message size. Message dropped"); |
|
|
|
|
|
|
|
i2p::DeleteI2NPMessage (it->second.data); |
|
|
|
|
|
|
|
m_IncompleteMessages.erase (it); |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
memcpy (incompleteMessage->buf + incompleteMessage->len, fragment, size); // concatenate fragment
|
|
|
|
memcpy (incompleteMessage->buf + incompleteMessage->len, fragment, size); // concatenate fragment
|
|
|
|
incompleteMessage->len += size; |
|
|
|
incompleteMessage->len += size; |
|
|
|
if (isLastFragment) |
|
|
|
if (isLastFragment) |
|
|
@ -144,6 +139,13 @@ namespace tunnel |
|
|
|
it->second.nextFragmentNum++; |
|
|
|
it->second.nextFragmentNum++; |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
LogPrint ("Fragment ", fragmentNum, " of message ", msgID, "exceeds max I2NP message size. Message dropped"); |
|
|
|
|
|
|
|
i2p::DeleteI2NPMessage (it->second.data); |
|
|
|
|
|
|
|
m_IncompleteMessages.erase (it); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
else |
|
|
|
{ |
|
|
|
{ |
|
|
|
LogPrint ("Unexpected fragment ", fragmentNum, " instead ", it->second.nextFragmentNum, " of message ", msgID, ". Discarded"); |
|
|
|
LogPrint ("Unexpected fragment ", fragmentNum, " instead ", it->second.nextFragmentNum, " of message ", msgID, ". Discarded"); |
|
|
|
i2p::DeleteI2NPMessage (it->second.data); |
|
|
|
i2p::DeleteI2NPMessage (it->second.data); |
|
|
@ -157,6 +159,9 @@ namespace tunnel |
|
|
|
// last message is follow-on fragment
|
|
|
|
// last message is follow-on fragment
|
|
|
|
// not passed to anywhere because first fragment
|
|
|
|
// not passed to anywhere because first fragment
|
|
|
|
i2p::DeleteI2NPMessage (msg); |
|
|
|
i2p::DeleteI2NPMessage (msg); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
// delete temporarty copy used for first fragment only
|
|
|
|
|
|
|
|
i2p::DeleteI2NPMessage (m.data); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
else |
|
|
|
else |
|
|
|