mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37:17 +01:00
close connection to first hop of declined tunnel
This commit is contained in:
parent
05d869254d
commit
8801a144a0
|
@ -359,6 +359,7 @@ namespace i2p
|
|||
else
|
||||
{
|
||||
LogPrint ("Outbound tunnel ", tunnel->GetTunnelID (), " has been declined");
|
||||
i2p::transports.CloseSession (tunnel->GetTunnelConfig ()->GetFirstHop ()->router);
|
||||
delete tunnel;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -263,6 +263,23 @@ namespace i2p
|
|||
}
|
||||
}
|
||||
|
||||
void Transports::CloseSession (const i2p::data::RouterInfo * router)
|
||||
{
|
||||
if (!router) return;
|
||||
m_Service.post (boost::bind (&Transports::PostCloseSession, this, router));
|
||||
}
|
||||
|
||||
void Transports::PostCloseSession (const i2p::data::RouterInfo * router)
|
||||
{
|
||||
auto ssuSession = m_SSUServer ? m_SSUServer->FindSession (router) : nullptr;
|
||||
if (ssuSession) // try SSU first
|
||||
{
|
||||
m_SSUServer->DeleteSession (ssuSession);
|
||||
LogPrint ("SSU session closed");
|
||||
}
|
||||
// TODO: delete NTCP
|
||||
}
|
||||
|
||||
void Transports::DetectExternalIP ()
|
||||
{
|
||||
for (int i = 0; i < 5; i ++)
|
||||
|
|
|
@ -63,13 +63,15 @@ namespace i2p
|
|||
i2p::ntcp::NTCPSession * FindNTCPSession (const i2p::data::IdentHash& ident);
|
||||
|
||||
void SendMessage (const i2p::data::IdentHash& ident, i2p::I2NPMessage * msg);
|
||||
|
||||
void CloseSession (const i2p::data::RouterInfo * router);
|
||||
|
||||
private:
|
||||
|
||||
void Run ();
|
||||
void HandleAccept (i2p::ntcp::NTCPServerConnection * conn, const boost::system::error_code& error);
|
||||
void PostMessage (const i2p::data::IdentHash& ident, i2p::I2NPMessage * msg);
|
||||
|
||||
void PostCloseSession (const i2p::data::RouterInfo * router);
|
||||
|
||||
void DetectExternalIP ();
|
||||
|
||||
private:
|
||||
|
|
|
@ -361,10 +361,12 @@ namespace tunnel
|
|||
void Tunnels::ManageTunnels ()
|
||||
{
|
||||
// check pending tunnel. if something is still there, wipe it out
|
||||
// because it wouldn't be reponded anyway
|
||||
// because it wouldn't be responded anyway
|
||||
for (auto& it : m_PendingTunnels)
|
||||
{
|
||||
LogPrint ("Pending tunnel build request ", it.first, " has not been responded. Deleted");
|
||||
if (it.second->GetTunnelConfig ()->GetFirstHop ()->isGateway) // outbound
|
||||
i2p::transports.CloseSession (it.second->GetTunnelConfig ()->GetFirstHop ()->router);
|
||||
delete it.second;
|
||||
}
|
||||
m_PendingTunnels.clear ();
|
||||
|
|
Loading…
Reference in a new issue