mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-11 13:27:52 +00:00
pass address to NTCP2 session
This commit is contained in:
parent
8f25b66760
commit
1235d18d67
@ -317,7 +317,8 @@ namespace transport
|
||||
return true;
|
||||
}
|
||||
|
||||
NTCP2Session::NTCP2Session (NTCP2Server& server, std::shared_ptr<const i2p::data::RouterInfo> in_RemoteRouter):
|
||||
NTCP2Session::NTCP2Session (NTCP2Server& server, std::shared_ptr<const i2p::data::RouterInfo> in_RemoteRouter,
|
||||
std::shared_ptr<const i2p::data::RouterInfo::Address> addr):
|
||||
TransportSession (in_RemoteRouter, NTCP2_ESTABLISH_TIMEOUT),
|
||||
m_Server (server), m_Socket (m_Server.GetService ()),
|
||||
m_IsEstablished (false), m_IsTerminated (false),
|
||||
@ -332,7 +333,8 @@ namespace transport
|
||||
if (in_RemoteRouter) // Alice
|
||||
{
|
||||
m_Establisher->m_RemoteIdentHash = GetRemoteIdentity ()->GetIdentHash ();
|
||||
auto addr = in_RemoteRouter->GetNTCP2Address (true); // we need a published address
|
||||
if (!addr)
|
||||
addr = in_RemoteRouter->GetNTCP2Address (true); // we need a published address
|
||||
if (addr)
|
||||
{
|
||||
memcpy (m_Establisher->m_RemoteStaticKey, addr->ntcp2->staticKey, 32);
|
||||
@ -653,7 +655,7 @@ namespace transport
|
||||
SendTerminationAndTerminate (eNTCP2Message3Error);
|
||||
return;
|
||||
}
|
||||
auto addr = ri.GetNTCP2Address (false); // any NTCP2 address
|
||||
auto addr = ri.GetNTCP2Address (false, false); // any NTCP2 address including v6
|
||||
if (!addr)
|
||||
{
|
||||
LogPrint (eLogError, "NTCP2: No NTCP2 address found in SessionConfirmed");
|
||||
|
@ -123,7 +123,8 @@ namespace transport
|
||||
{
|
||||
public:
|
||||
|
||||
NTCP2Session (NTCP2Server& server, std::shared_ptr<const i2p::data::RouterInfo> in_RemoteRouter = nullptr);
|
||||
NTCP2Session (NTCP2Server& server, std::shared_ptr<const i2p::data::RouterInfo> in_RemoteRouter = nullptr,
|
||||
std::shared_ptr<const i2p::data::RouterInfo::Address> addr = nullptr);
|
||||
~NTCP2Session ();
|
||||
void Terminate ();
|
||||
void TerminateByTimeout ();
|
||||
|
@ -398,7 +398,7 @@ namespace transport
|
||||
auto address = peer.router->GetNTCP2Address (true, !context.SupportsV6 ()); // published only
|
||||
if (address && !peer.router->IsUnreachable () && (!m_CheckReserved || !i2p::util::net::IsInReservedRange(address->host)))
|
||||
{
|
||||
auto s = std::make_shared<NTCP2Session> (*m_NTCP2Server, peer.router);
|
||||
auto s = std::make_shared<NTCP2Session> (*m_NTCP2Server, peer.router, address);
|
||||
|
||||
if(m_NTCP2Server->UsingProxy())
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user