mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
find actual router for peer
This commit is contained in:
parent
43d458cf72
commit
1d5d06f731
2 changed files with 13 additions and 6 deletions
|
@ -406,6 +406,7 @@ namespace tunnel
|
|||
|
||||
bool StandardSelectPeers(Path & peers, int numHops, bool inbound, SelectHopFunc nextHop)
|
||||
{
|
||||
int start = 0;
|
||||
auto prevHop = i2p::context.GetSharedRouterInfo ();
|
||||
if(i2p::transport::transports.RoutesRestricted())
|
||||
{
|
||||
|
@ -414,6 +415,7 @@ namespace tunnel
|
|||
if(!hop) return false;
|
||||
peers.push_back(hop->GetRouterIdentity());
|
||||
prevHop = hop;
|
||||
start++;
|
||||
}
|
||||
else if (i2p::transport::transports.GetNumPeers () > 25)
|
||||
{
|
||||
|
@ -423,11 +425,11 @@ namespace tunnel
|
|||
{
|
||||
prevHop = r;
|
||||
peers.push_back (r->GetRouterIdentity ());
|
||||
numHops--;
|
||||
start++;
|
||||
}
|
||||
}
|
||||
|
||||
for(int i = 0; i < numHops; i++ )
|
||||
for(int i = start; i < numHops; i++ )
|
||||
{
|
||||
auto hop = nextHop (prevHop, inbound);
|
||||
if (!hop && !i) // if no suitable peer found for first hop, try already connected
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue