|
|
@ -642,11 +642,7 @@ namespace tunnel |
|
|
|
{ |
|
|
|
{ |
|
|
|
// trying to create one more oubound tunnel
|
|
|
|
// trying to create one more oubound tunnel
|
|
|
|
auto inboundTunnel = GetNextInboundTunnel (); |
|
|
|
auto inboundTunnel = GetNextInboundTunnel (); |
|
|
|
std::shared_ptr<const i2p::data::RouterInfo> router(nullptr); |
|
|
|
auto router = i2p::data::netdb.GetRandomRouter (); |
|
|
|
if (i2p::transport::transports.RoutesRestricted()) |
|
|
|
|
|
|
|
router = i2p::transport::transports.GetRestrictedPeer(); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
router = i2p::data::netdb.GetRandomRouter (); |
|
|
|
|
|
|
|
if (!inboundTunnel || !router) return; |
|
|
|
if (!inboundTunnel || !router) return; |
|
|
|
LogPrint (eLogDebug, "Tunnel: creating one hop outbound tunnel"); |
|
|
|
LogPrint (eLogDebug, "Tunnel: creating one hop outbound tunnel"); |
|
|
|
CreateTunnel<OutboundTunnel> ( |
|
|
|
CreateTunnel<OutboundTunnel> ( |
|
|
@ -708,12 +704,8 @@ namespace tunnel |
|
|
|
if (m_OutboundTunnels.empty () || m_InboundTunnels.size () < 5) |
|
|
|
if (m_OutboundTunnels.empty () || m_InboundTunnels.size () < 5) |
|
|
|
{ |
|
|
|
{ |
|
|
|
// trying to create one more inbound tunnel
|
|
|
|
// trying to create one more inbound tunnel
|
|
|
|
std::shared_ptr<const i2p::data::RouterInfo> router(nullptr); |
|
|
|
auto router = i2p::data::netdb.GetRandomRouter (); |
|
|
|
if (i2p::transport::transports.RoutesRestricted()) |
|
|
|
if (!router) { |
|
|
|
router = i2p::transport::transports.GetRestrictedPeer(); |
|
|
|
|
|
|
|
else |
|
|
|
|
|
|
|
router = i2p::data::netdb.GetRandomRouter (); |
|
|
|
|
|
|
|
if (!router) { |
|
|
|
|
|
|
|
LogPrint (eLogWarning, "Tunnel: can't find any router, skip creating tunnel"); |
|
|
|
LogPrint (eLogWarning, "Tunnel: can't find any router, skip creating tunnel"); |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|