1
0
mirror of https://github.com/PurpleI2P/i2pd.git synced 2025-01-31 04:44:13 +00:00

delete pending outgoind session when SessionCreated received

This commit is contained in:
orignal 2022-06-22 13:15:25 -04:00
parent 5de224d6bf
commit bceae244c1
3 changed files with 7 additions and 0 deletions

View File

@ -286,6 +286,11 @@ namespace transport
return nullptr; return nullptr;
} }
void SSU2Server::RemovePendingOutgoingSession (const boost::asio::ip::udp::endpoint& ep)
{
m_PendingOutgoingSessions.erase (ep);
}
std::shared_ptr<SSU2Session> SSU2Server::GetRandomSession (i2p::data::RouterInfo::CompatibleTransports remoteTransports) const std::shared_ptr<SSU2Session> SSU2Server::GetRandomSession (i2p::data::RouterInfo::CompatibleTransports remoteTransports) const
{ {
if (m_Sessions.empty ()) return nullptr; if (m_Sessions.empty ()) return nullptr;

View File

@ -55,6 +55,7 @@ namespace transport
void RemoveSession (uint64_t connID); void RemoveSession (uint64_t connID);
void AddSessionByRouterHash (std::shared_ptr<SSU2Session> session); void AddSessionByRouterHash (std::shared_ptr<SSU2Session> session);
bool AddPendingOutgoingSession (std::shared_ptr<SSU2Session> session); bool AddPendingOutgoingSession (std::shared_ptr<SSU2Session> session);
void RemovePendingOutgoingSession (const boost::asio::ip::udp::endpoint& ep);
std::shared_ptr<SSU2Session> FindSession (const i2p::data::IdentHash& ident) const; std::shared_ptr<SSU2Session> FindSession (const i2p::data::IdentHash& ident) const;
std::shared_ptr<SSU2Session> FindPendingOutgoingSession (const boost::asio::ip::udp::endpoint& ep) const; std::shared_ptr<SSU2Session> FindPendingOutgoingSession (const boost::asio::ip::udp::endpoint& ep) const;
std::shared_ptr<SSU2Session> GetRandomSession (i2p::data::RouterInfo::CompatibleTransports remoteTransports) const; std::shared_ptr<SSU2Session> GetRandomSession (i2p::data::RouterInfo::CompatibleTransports remoteTransports) const;

View File

@ -545,6 +545,7 @@ namespace transport
HandlePayload (decryptedPayload.data (), decryptedPayload.size ()); HandlePayload (decryptedPayload.data (), decryptedPayload.size ());
m_Server.AddSession (shared_from_this ()); m_Server.AddSession (shared_from_this ());
m_Server.RemovePendingOutgoingSession (m_RemoteEndpoint);
SendSessionConfirmed (headerX + 16); SendSessionConfirmed (headerX + 16);
KDFDataPhase (m_KeyDataSend, m_KeyDataReceive); KDFDataPhase (m_KeyDataSend, m_KeyDataReceive);
Established (); Established ();