mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37:17 +01:00
always create new tunnel from exploratory pool
This commit is contained in:
parent
e77e383efa
commit
a0e545a6f1
|
@ -393,10 +393,14 @@ namespace tunnel
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TunnelPool::IsExploratory () const
|
||||||
|
{
|
||||||
|
return i2p::tunnel::tunnels.GetExploratoryPool () == shared_from_this ();
|
||||||
|
}
|
||||||
|
|
||||||
std::shared_ptr<const i2p::data::RouterInfo> TunnelPool::SelectNextHop (std::shared_ptr<const i2p::data::RouterInfo> prevHop, bool reverse) const
|
std::shared_ptr<const i2p::data::RouterInfo> TunnelPool::SelectNextHop (std::shared_ptr<const i2p::data::RouterInfo> prevHop, bool reverse) const
|
||||||
{
|
{
|
||||||
bool isExploratory = (i2p::tunnel::tunnels.GetExploratoryPool () == shared_from_this ());
|
auto hop = IsExploratory () ? i2p::data::netdb.GetRandomRouter (prevHop, reverse):
|
||||||
auto hop = isExploratory ? i2p::data::netdb.GetRandomRouter (prevHop, reverse):
|
|
||||||
i2p::data::netdb.GetHighBandwidthRandomRouter (prevHop, reverse);
|
i2p::data::netdb.GetHighBandwidthRandomRouter (prevHop, reverse);
|
||||||
|
|
||||||
if (!hop || hop->GetProfile ()->IsBad ())
|
if (!hop || hop->GetProfile ()->IsBad ())
|
||||||
|
@ -521,6 +525,11 @@ namespace tunnel
|
||||||
|
|
||||||
void TunnelPool::RecreateInboundTunnel (std::shared_ptr<InboundTunnel> tunnel)
|
void TunnelPool::RecreateInboundTunnel (std::shared_ptr<InboundTunnel> tunnel)
|
||||||
{
|
{
|
||||||
|
if (IsExploratory ()) // always create new exploratory tunnel
|
||||||
|
{
|
||||||
|
CreateInboundTunnel ();
|
||||||
|
return;
|
||||||
|
}
|
||||||
auto outboundTunnel = GetNextOutboundTunnel ();
|
auto outboundTunnel = GetNextOutboundTunnel ();
|
||||||
if (!outboundTunnel)
|
if (!outboundTunnel)
|
||||||
outboundTunnel = tunnels.GetNextOutboundTunnel ();
|
outboundTunnel = tunnels.GetNextOutboundTunnel ();
|
||||||
|
@ -567,6 +576,11 @@ namespace tunnel
|
||||||
|
|
||||||
void TunnelPool::RecreateOutboundTunnel (std::shared_ptr<OutboundTunnel> tunnel)
|
void TunnelPool::RecreateOutboundTunnel (std::shared_ptr<OutboundTunnel> tunnel)
|
||||||
{
|
{
|
||||||
|
if (IsExploratory ()) // always create new exploratory tunnel
|
||||||
|
{
|
||||||
|
CreateOutboundTunnel ();
|
||||||
|
return;
|
||||||
|
}
|
||||||
auto inboundTunnel = GetNextInboundTunnel ();
|
auto inboundTunnel = GetNextInboundTunnel ();
|
||||||
if (!inboundTunnel)
|
if (!inboundTunnel)
|
||||||
inboundTunnel = tunnels.GetNextInboundTunnel ();
|
inboundTunnel = tunnels.GetNextInboundTunnel ();
|
||||||
|
|
|
@ -77,6 +77,7 @@ namespace tunnel
|
||||||
void ProcessGarlicMessage (std::shared_ptr<I2NPMessage> msg);
|
void ProcessGarlicMessage (std::shared_ptr<I2NPMessage> msg);
|
||||||
void ProcessDeliveryStatus (std::shared_ptr<I2NPMessage> msg);
|
void ProcessDeliveryStatus (std::shared_ptr<I2NPMessage> msg);
|
||||||
|
|
||||||
|
bool IsExploratory () const;
|
||||||
bool IsActive () const { return m_IsActive; };
|
bool IsActive () const { return m_IsActive; };
|
||||||
void SetActive (bool isActive) { m_IsActive = isActive; };
|
void SetActive (bool isActive) { m_IsActive = isActive; };
|
||||||
void DetachTunnels ();
|
void DetachTunnels ();
|
||||||
|
|
Loading…
Reference in a new issue