mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-27 11:17:49 +02:00
select first hop from existing connections if applicable
This commit is contained in:
parent
7f172964f6
commit
d2b4a6fd50
3 changed files with 23 additions and 2 deletions
|
@ -4,6 +4,7 @@
|
|||
#include "NetDb.h"
|
||||
#include "Timestamp.h"
|
||||
#include "Garlic.h"
|
||||
#include "Transports.h"
|
||||
#include "TunnelPool.h"
|
||||
|
||||
namespace i2p
|
||||
|
@ -341,10 +342,20 @@ namespace tunnel
|
|||
if (inboundTunnel)
|
||||
{
|
||||
LogPrint ("Creating destination outbound tunnel...");
|
||||
|
||||
int numHops = m_NumOutboundHops;
|
||||
auto prevHop = i2p::context.GetSharedRouterInfo ();
|
||||
std::vector<std::shared_ptr<const i2p::data::RouterInfo> > hops;
|
||||
for (int i = 0; i < m_NumOutboundHops; i++)
|
||||
if (i2p::transport::transports.GetNumPeers () > 25)
|
||||
{
|
||||
auto r = i2p::transport::transports.GetRandomPeer ();
|
||||
if (r)
|
||||
{
|
||||
prevHop = r;
|
||||
hops.push_back (r);
|
||||
numHops--;
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < numHops; i++)
|
||||
{
|
||||
auto hop = SelectNextHop (prevHop);
|
||||
if (!hop)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue