mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
exclude expired SSU2 introducers
This commit is contained in:
parent
24e325db62
commit
827a88d772
2 changed files with 57 additions and 24 deletions
|
@ -499,16 +499,20 @@ namespace transport
|
|||
}
|
||||
}
|
||||
// we have to start a new session to an introducer
|
||||
auto ts = i2p::util::GetSecondsSinceEpoch ();
|
||||
std::shared_ptr<i2p::data::RouterInfo> r;
|
||||
uint32_t relayTag = 0;
|
||||
for (auto& it: address->ssu->introducers)
|
||||
{
|
||||
r = i2p::data::netdb.FindRouter (it.iKey);
|
||||
if (r && r->IsReachableFrom (i2p::context.GetRouterInfo ()))
|
||||
{
|
||||
relayTag = it.iTag;
|
||||
if (relayTag) break;
|
||||
}
|
||||
if (it.iTag && ts < it.iExp)
|
||||
{
|
||||
r = i2p::data::netdb.FindRouter (it.iKey);
|
||||
if (r && r->IsReachableFrom (i2p::context.GetRouterInfo ()))
|
||||
{
|
||||
relayTag = it.iTag;
|
||||
if (relayTag) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (r)
|
||||
{
|
||||
|
@ -548,7 +552,8 @@ namespace transport
|
|||
{
|
||||
// introducers not found, try to request them
|
||||
for (auto& it: address->ssu->introducers)
|
||||
i2p::data::netdb.RequestDestination (it.iKey);
|
||||
if (it.iTag && ts < it.iExp)
|
||||
i2p::data::netdb.RequestDestination (it.iKey);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue