|
|
@ -22,7 +22,7 @@ namespace ssu |
|
|
|
} |
|
|
|
} |
|
|
|
for (auto it: m_SentMessages) |
|
|
|
for (auto it: m_SentMessages) |
|
|
|
{ |
|
|
|
{ |
|
|
|
for (auto f: it.second) |
|
|
|
for (auto f: it.second.fragments) |
|
|
|
delete[] f; |
|
|
|
delete[] f; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
@ -33,7 +33,7 @@ namespace ssu |
|
|
|
if (it != m_SentMessages.end ()) |
|
|
|
if (it != m_SentMessages.end ()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// delete all ack-ed message's fragments
|
|
|
|
// delete all ack-ed message's fragments
|
|
|
|
for (auto f: it->second) |
|
|
|
for (auto f: it->second.fragments) |
|
|
|
delete[] f; |
|
|
|
delete[] f; |
|
|
|
m_SentMessages.erase (it); |
|
|
|
m_SentMessages.erase (it); |
|
|
|
} |
|
|
|
} |
|
|
@ -59,8 +59,7 @@ namespace ssu |
|
|
|
{ |
|
|
|
{ |
|
|
|
uint32_t msgID = be32toh (*(uint32_t *)buf); |
|
|
|
uint32_t msgID = be32toh (*(uint32_t *)buf); |
|
|
|
buf += 4; // msgID
|
|
|
|
buf += 4; // msgID
|
|
|
|
auto it = m_SentMessages.find (msgID); |
|
|
|
auto it = m_SentMessages.find (msgID); |
|
|
|
int numSentFragments = it->second.size (); |
|
|
|
|
|
|
|
// process individual Ack bitfields
|
|
|
|
// process individual Ack bitfields
|
|
|
|
bool isNonLast = false; |
|
|
|
bool isNonLast = false; |
|
|
|
int fragment = 0; |
|
|
|
int fragment = 0; |
|
|
@ -71,6 +70,7 @@ namespace ssu |
|
|
|
bitfield &= 0x7F; // clear MSB
|
|
|
|
bitfield &= 0x7F; // clear MSB
|
|
|
|
if (bitfield && it != m_SentMessages.end ()) |
|
|
|
if (bitfield && it != m_SentMessages.end ()) |
|
|
|
{ |
|
|
|
{ |
|
|
|
|
|
|
|
int numSentFragments = it->second.fragments.size (); |
|
|
|
// process bits
|
|
|
|
// process bits
|
|
|
|
uint8_t mask = 0x40; |
|
|
|
uint8_t mask = 0x40; |
|
|
|
for (int j = 0; j < 7; j++) |
|
|
|
for (int j = 0; j < 7; j++) |
|
|
@ -79,8 +79,8 @@ namespace ssu |
|
|
|
{ |
|
|
|
{ |
|
|
|
if (fragment < numSentFragments) |
|
|
|
if (fragment < numSentFragments) |
|
|
|
{ |
|
|
|
{ |
|
|
|
delete[] it->second[fragment]; |
|
|
|
delete[] it->second.fragments[fragment]; |
|
|
|
it->second[fragment] = nullptr; |
|
|
|
it->second.fragments[fragment] = nullptr; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
fragment++; |
|
|
|
fragment++; |
|
|
@ -238,7 +238,8 @@ namespace ssu |
|
|
|
DeleteI2NPMessage (msg); |
|
|
|
DeleteI2NPMessage (msg); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
auto fragments = m_SentMessages[msgID]; |
|
|
|
SentMessage& sentMessage = m_SentMessages[msgID]; |
|
|
|
|
|
|
|
auto& fragments = sentMessage.fragments; |
|
|
|
msgID = htobe32 (msgID); |
|
|
|
msgID = htobe32 (msgID); |
|
|
|
size_t payloadSize = SSU_MTU - sizeof (SSUHeader) - 9; // 9 = flag + #frg(1) + messageID(4) + frag info (3)
|
|
|
|
size_t payloadSize = SSU_MTU - sizeof (SSUHeader) - 9; // 9 = flag + #frg(1) + messageID(4) + frag info (3)
|
|
|
|
size_t len = msg->GetLength (); |
|
|
|
size_t len = msg->GetLength (); |
|
|
|