mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 13:27:17 +01:00
pick routers with any bandwidth if limited connectivity
This commit is contained in:
parent
e4962b855f
commit
c8958d71a2
|
@ -549,12 +549,12 @@ namespace tunnel
|
||||||
std::shared_ptr<const i2p::data::RouterInfo> TunnelPool::SelectNextHop (std::shared_ptr<const i2p::data::RouterInfo> prevHop,
|
std::shared_ptr<const i2p::data::RouterInfo> TunnelPool::SelectNextHop (std::shared_ptr<const i2p::data::RouterInfo> prevHop,
|
||||||
bool reverse, bool endpoint) const
|
bool reverse, bool endpoint) const
|
||||||
{
|
{
|
||||||
bool tryClient = !IsExploratory ();
|
bool tryClient = !IsExploratory () && !i2p::context.IsLimitedConnectivity ();
|
||||||
std::shared_ptr<const i2p::data::RouterInfo> hop;
|
std::shared_ptr<const i2p::data::RouterInfo> hop;
|
||||||
for (int i = 0; i < TUNNEL_POOL_MAX_HOP_SELECTION_ATTEMPTS; i++)
|
for (int i = 0; i < TUNNEL_POOL_MAX_HOP_SELECTION_ATTEMPTS; i++)
|
||||||
{
|
{
|
||||||
hop = tryClient ?
|
hop = tryClient ?
|
||||||
(m_IsHighBandwidth ?
|
(m_IsHighBandwidth ?
|
||||||
i2p::data::netdb.GetHighBandwidthRandomRouter (prevHop, reverse, endpoint) :
|
i2p::data::netdb.GetHighBandwidthRandomRouter (prevHop, reverse, endpoint) :
|
||||||
i2p::data::netdb.GetRandomRouter (prevHop, reverse, endpoint, true)):
|
i2p::data::netdb.GetRandomRouter (prevHop, reverse, endpoint, true)):
|
||||||
i2p::data::netdb.GetRandomRouter (prevHop, reverse, endpoint, false);
|
i2p::data::netdb.GetRandomRouter (prevHop, reverse, endpoint, false);
|
||||||
|
@ -587,7 +587,7 @@ namespace tunnel
|
||||||
else if (i2p::transport::transports.GetNumPeers () > 100 ||
|
else if (i2p::transport::transports.GetNumPeers () > 100 ||
|
||||||
(inbound && i2p::transport::transports.GetNumPeers () > 25))
|
(inbound && i2p::transport::transports.GetNumPeers () > 25))
|
||||||
{
|
{
|
||||||
auto r = i2p::transport::transports.GetRandomPeer (m_IsHighBandwidth);
|
auto r = i2p::transport::transports.GetRandomPeer (m_IsHighBandwidth && !i2p::context.IsLimitedConnectivity ());
|
||||||
if (r && r->IsECIES () && !r->GetProfile ()->IsBad () &&
|
if (r && r->IsECIES () && !r->GetProfile ()->IsBad () &&
|
||||||
(numHops > 1 || (r->IsV4 () && (!inbound || r->IsPublished (true))))) // first inbound must be published ipv4
|
(numHops > 1 || (r->IsV4 () && (!inbound || r->IsPublished (true))))) // first inbound must be published ipv4
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue