From f56ae240abbf830803ad68028dcfff7ad3a2e655 Mon Sep 17 00:00:00 2001 From: orignal Date: Mon, 21 Mar 2022 12:56:02 -0400 Subject: [PATCH] don't delete peding endpoint if Retry received --- libi2pd/SSU2.cpp | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/libi2pd/SSU2.cpp b/libi2pd/SSU2.cpp index bec6798f..cc75c31f 100644 --- a/libi2pd/SSU2.cpp +++ b/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) header.ll[1] ^= CreateHeaderMask (kh2, buf + (len - 12)); if (header.h.type != eSSU2SessionCreated) - { - LogPrint (eLogWarning, "SSU2: Unexpected message type ", (int)header.h.type); + // this situation is valid, because it might be Retry with different encryption return false; - } const uint8_t nonce[12] = {0}; uint8_t headerX[48]; i2p::crypto::ChaCha20 (buf + 16, 48, kh2, nonce, headerX); @@ -502,9 +500,10 @@ namespace transport auto it1 = m_PendingOutgoingSessions.find (senderEndpoint); if (it1 != m_PendingOutgoingSessions.end ()) { - if (it1->second->ProcessSessionCreated (buf, len) || - it1->second->ProcessRetry (buf, len)) - m_PendingOutgoingSessions.erase (it1); + if (it1->second->ProcessSessionCreated (buf, len)) + m_PendingOutgoingSessions.erase (it1); // we are done with that endpoint + else + it1->second->ProcessRetry (buf, len); } else {