From 161ff3579b41446abefb77f1df714d9a08fde74f Mon Sep 17 00:00:00 2001 From: orignal Date: Fri, 15 Mar 2024 20:12:47 -0400 Subject: [PATCH] don't delete new session with same router hash from sessions-by-hash table --- libi2pd/SSU2.cpp | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/libi2pd/SSU2.cpp b/libi2pd/SSU2.cpp index 812f49d3..a41619d6 100644 --- a/libi2pd/SSU2.cpp +++ b/libi2pd/SSU2.cpp @@ -436,7 +436,11 @@ namespace transport { auto ident = it->second->GetRemoteIdentity (); if (ident) - m_SessionsByRouterHash.erase (ident->GetIdentHash ()); + { + auto it1 = m_SessionsByRouterHash.find (ident->GetIdentHash ()); + if (it1 != m_SessionsByRouterHash.end () && it->second == it1->second) + m_SessionsByRouterHash.erase (it1); + } if (m_LastSession == it->second) m_LastSession = nullptr; m_Sessions.erase (it);