Browse Source

request only not found routers from introducers

pull/2072/head
orignal 7 months ago
parent
commit
df6d48dbae
  1. 21
      libi2pd/SSU2.cpp

21
libi2pd/SSU2.cpp

@ -794,6 +794,7 @@ namespace transport
i++; i++;
} }
// we have to start a new session to an introducer // we have to start a new session to an introducer
std::vector<i2p::data::IdentHash> newRouters;
std::shared_ptr<i2p::data::RouterInfo> r; std::shared_ptr<i2p::data::RouterInfo> r;
uint32_t relayTag = 0; uint32_t relayTag = 0;
if (!indices.empty ()) if (!indices.empty ())
@ -806,11 +807,16 @@ namespace transport
const auto& introducer = address->ssu->introducers[ind]; const auto& introducer = address->ssu->introducers[ind];
// introducer is not expired, because in indices // introducer is not expired, because in indices
r = i2p::data::netdb.FindRouter (introducer.iH); r = i2p::data::netdb.FindRouter (introducer.iH);
if (r && r->IsReachableFrom (i2p::context.GetRouterInfo ())) if (r)
{ {
relayTag = introducer.iTag; if (r->IsReachableFrom (i2p::context.GetRouterInfo ()))
if (relayTag) break; {
} relayTag = introducer.iTag;
if (relayTag) break;
}
}
else if (i2p::data::IsRouterBanned (introducer.iH))
newRouters.push_back (introducer.iH);
} }
} }
if (r) if (r)
@ -851,9 +857,8 @@ namespace transport
else else
{ {
// introducers not found, try to request them // introducers not found, try to request them
for (auto& it: address->ssu->introducers) for (auto& it: newRouters)
if (it.iTag && ts < it.iExp) i2p::data::netdb.RequestDestination (it);
i2p::data::netdb.RequestDestination (it.iH);
} }
} }

Loading…
Cancel
Save