From 8462d382f4e5ab12e2b6b01c071cf83dce63f22d Mon Sep 17 00:00:00 2001 From: orignal Date: Mon, 29 Mar 2021 15:16:39 -0400 Subject: [PATCH] don't create SSU session for HolePunch --- libi2pd/SSU.cpp | 4 ++-- libi2pd/SSUSession.cpp | 2 ++ 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/libi2pd/SSU.cpp b/libi2pd/SSU.cpp index b9b3a04e..111f9407 100644 --- a/libi2pd/SSU.cpp +++ b/libi2pd/SSU.cpp @@ -1,5 +1,5 @@ /* -* Copyright (c) 2013-2020, The PurpleI2P Project +* Copyright (c) 2013-2021, The PurpleI2P Project * * This file is part of Purple i2pd project and licensed under BSD3 * @@ -385,7 +385,7 @@ namespace transport auto it = sessions->find (packet->from); if (it != sessions->end ()) session = it->second; - if (!session) + if (!session && packet->len > 0) { session = std::make_shared (*this, packet->from); session->WaitForConnect (); diff --git a/libi2pd/SSUSession.cpp b/libi2pd/SSUSession.cpp index 2e49e970..09be219f 100644 --- a/libi2pd/SSUSession.cpp +++ b/libi2pd/SSUSession.cpp @@ -418,6 +418,7 @@ namespace transport else FillHeaderAndEncrypt (PAYLOAD_TYPE_RELAY_REQUEST, buf, 96, introducer.iKey, iv, introducer.iKey); m_Server.Send (buf, 96, m_RemoteEndpoint); + LogPrint (eLogDebug, "SSU: relay request sent"); } void SSUSession::SendSessionCreated (const uint8_t * x, bool sendRelayTag) @@ -682,6 +683,7 @@ namespace transport LogPrint (eLogInfo, "SSU: RelayReponse connecting to endpoint ", remoteEndpoint); if (i2p::context.GetRouterInfo ().UsesIntroducer ()) // if we are unreachable m_Server.Send (buf, 0, remoteEndpoint); // send HolePunch + // we assume that HolePunch has been sent by this time and our SessionRequest will go through m_Server.CreateDirectSession (it->second, remoteEndpoint, false); } // delete request