Browse Source

delete pending outgoind session when SessionCreated received

pull/1769/head
orignal 2 years ago
parent
commit
bceae244c1
  1. 5
      libi2pd/SSU2.cpp
  2. 1
      libi2pd/SSU2.h
  3. 1
      libi2pd/SSU2Session.cpp

5
libi2pd/SSU2.cpp

@ -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;

1
libi2pd/SSU2.h

@ -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;

1
libi2pd/SSU2Session.cpp

@ -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 ();

Loading…
Cancel
Save