mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
try to find destination at every connect attempt
This commit is contained in:
parent
d8918edb51
commit
fcb45a778b
3 changed files with 94 additions and 73 deletions
|
@ -131,7 +131,6 @@ namespace stream
|
|||
for (auto it: m_Connections)
|
||||
delete it;
|
||||
m_Connections.clear ();
|
||||
delete m_DestinationIdentHash;
|
||||
m_DestinationIdentHash = nullptr;
|
||||
}
|
||||
|
||||
|
@ -146,16 +145,33 @@ namespace stream
|
|||
{
|
||||
if (!ecode)
|
||||
{
|
||||
if (!m_RemoteLeaseSet && m_DestinationIdentHash)
|
||||
m_RemoteLeaseSet = i2p::data::netdb.FindLeaseSet (*m_DestinationIdentHash);
|
||||
if (m_RemoteLeaseSet)
|
||||
if (!m_RemoteLeaseSet)
|
||||
{
|
||||
// try to get it
|
||||
if (m_DestinationIdentHash)
|
||||
m_RemoteLeaseSet = i2p::data::netdb.FindLeaseSet (*m_DestinationIdentHash);
|
||||
else
|
||||
{
|
||||
auto identHash = i2p::data::netdb.FindAddress (m_Destination);
|
||||
if (identHash)
|
||||
{
|
||||
m_DestinationIdentHash = new i2p::data::IdentHash (*identHash);
|
||||
i2p::data::netdb.Subscribe (*m_DestinationIdentHash);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (m_RemoteLeaseSet) // leaseSet found
|
||||
{
|
||||
LogPrint ("New I2PTunnel connection");
|
||||
auto connection = new I2PTunnelConnection (socket, m_RemoteLeaseSet);
|
||||
m_Connections.insert (connection);
|
||||
}
|
||||
else
|
||||
{
|
||||
LogPrint ("LeaseSet for I2PTunnel destination not found");
|
||||
delete socket;
|
||||
}
|
||||
Accept ();
|
||||
}
|
||||
else
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue