mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-08 18:47:52 +00:00
correct termination if session already exists
This commit is contained in:
parent
4e1319d874
commit
49c1e47736
@ -706,7 +706,8 @@ namespace transport
|
|||||||
// ready to communicate
|
// ready to communicate
|
||||||
auto existing = i2p::data::netdb.FindRouter (ri.GetRouterIdentity ()->GetIdentHash ()); // check if exists already
|
auto existing = i2p::data::netdb.FindRouter (ri.GetRouterIdentity ()->GetIdentHash ()); // check if exists already
|
||||||
SetRemoteIdentity (existing ? existing->GetRouterIdentity () : ri.GetRouterIdentity ());
|
SetRemoteIdentity (existing ? existing->GetRouterIdentity () : ri.GetRouterIdentity ());
|
||||||
m_Server.AddNTCP2Session (shared_from_this (), true);
|
if (m_Server.AddNTCP2Session (shared_from_this (), true))
|
||||||
|
{
|
||||||
Established ();
|
Established ();
|
||||||
ReceiveLength ();
|
ReceiveLength ();
|
||||||
}
|
}
|
||||||
@ -716,6 +717,9 @@ namespace transport
|
|||||||
else
|
else
|
||||||
Terminate ();
|
Terminate ();
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
Terminate ();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void NTCP2Session::SetSipKeys (const uint8_t * sendSipKey, const uint8_t * receiveSipKey)
|
void NTCP2Session::SetSipKeys (const uint8_t * sendSipKey, const uint8_t * receiveSipKey)
|
||||||
@ -1258,7 +1262,6 @@ namespace transport
|
|||||||
if (it != m_NTCP2Sessions.end ())
|
if (it != m_NTCP2Sessions.end ())
|
||||||
{
|
{
|
||||||
LogPrint (eLogWarning, "NTCP2: session to ", ident.ToBase64 (), " already exists");
|
LogPrint (eLogWarning, "NTCP2: session to ", ident.ToBase64 (), " already exists");
|
||||||
session->Terminate();
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
m_NTCP2Sessions.insert (std::make_pair (ident, session));
|
m_NTCP2Sessions.insert (std::make_pair (ident, session));
|
||||||
@ -1301,6 +1304,8 @@ namespace transport
|
|||||||
});
|
});
|
||||||
conn->GetSocket ().async_connect (boost::asio::ip::tcp::endpoint (address, port), std::bind (&NTCP2Server::HandleConnect, this, std::placeholders::_1, conn, timer));
|
conn->GetSocket ().async_connect (boost::asio::ip::tcp::endpoint (address, port), std::bind (&NTCP2Server::HandleConnect, this, std::placeholders::_1, conn, timer));
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
conn->Terminate ();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user