Browse Source

don't delete peding endpoint if Retry received

pull/1748/head
orignal 3 years ago
parent
commit
f56ae240ab
  1. 11
      libi2pd/SSU2.cpp

11
libi2pd/SSU2.cpp

@ -199,10 +199,8 @@ namespace transport
i2p::crypto::HKDF (m_NoiseState->m_CK, nullptr, 0, "SessCreateHeader", kh2, 32); // k_header_2 = HKDF(chainKey, ZEROLEN, "SessCreateHeader", 32) i2p::crypto::HKDF (m_NoiseState->m_CK, nullptr, 0, "SessCreateHeader", kh2, 32); // k_header_2 = HKDF(chainKey, ZEROLEN, "SessCreateHeader", 32)
header.ll[1] ^= CreateHeaderMask (kh2, buf + (len - 12)); header.ll[1] ^= CreateHeaderMask (kh2, buf + (len - 12));
if (header.h.type != eSSU2SessionCreated) if (header.h.type != eSSU2SessionCreated)
{ // this situation is valid, because it might be Retry with different encryption
LogPrint (eLogWarning, "SSU2: Unexpected message type ", (int)header.h.type);
return false; return false;
}
const uint8_t nonce[12] = {0}; const uint8_t nonce[12] = {0};
uint8_t headerX[48]; uint8_t headerX[48];
i2p::crypto::ChaCha20 (buf + 16, 48, kh2, nonce, headerX); i2p::crypto::ChaCha20 (buf + 16, 48, kh2, nonce, headerX);
@ -502,9 +500,10 @@ namespace transport
auto it1 = m_PendingOutgoingSessions.find (senderEndpoint); auto it1 = m_PendingOutgoingSessions.find (senderEndpoint);
if (it1 != m_PendingOutgoingSessions.end ()) if (it1 != m_PendingOutgoingSessions.end ())
{ {
if (it1->second->ProcessSessionCreated (buf, len) || if (it1->second->ProcessSessionCreated (buf, len))
it1->second->ProcessRetry (buf, len)) m_PendingOutgoingSessions.erase (it1); // we are done with that endpoint
m_PendingOutgoingSessions.erase (it1); else
it1->second->ProcessRetry (buf, len);
} }
else else
{ {

Loading…
Cancel
Save