mirror of
https://github.com/PurpleI2P/i2pd
synced 2024-11-10 00:00:29 +03:00
don't publish slow tunnel in LeaseSet if possible
This commit is contained in:
parent
a92b93192d
commit
e412b17f70
@ -142,16 +142,24 @@ namespace tunnel
|
|||||||
{
|
{
|
||||||
std::vector<std::shared_ptr<InboundTunnel> > v;
|
std::vector<std::shared_ptr<InboundTunnel> > v;
|
||||||
int i = 0;
|
int i = 0;
|
||||||
|
std::shared_ptr<InboundTunnel> slowTunnel;
|
||||||
std::unique_lock<std::mutex> l(m_InboundTunnelsMutex);
|
std::unique_lock<std::mutex> l(m_InboundTunnelsMutex);
|
||||||
for (const auto& it : m_InboundTunnels)
|
for (const auto& it : m_InboundTunnels)
|
||||||
{
|
{
|
||||||
if (i >= num) break;
|
if (i >= num) break;
|
||||||
if (it->IsEstablished ())
|
if (it->IsEstablished ())
|
||||||
{
|
{
|
||||||
v.push_back (it);
|
if (it->IsSlow () && !slowTunnel)
|
||||||
i++;
|
slowTunnel = it;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
v.push_back (it);
|
||||||
|
i++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (slowTunnel && (int)v.size () < (num/2+1))
|
||||||
|
v.push_back (slowTunnel);
|
||||||
return v;
|
return v;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user