Browse Source

publish 0-hops leaseset

pull/712/head
orignal 8 years ago
parent
commit
e0e50faa47
  1. 19
      TunnelPool.cpp

19
TunnelPool.cpp

@ -216,21 +216,24 @@ namespace tunnel
{ {
int num = 0; int num = 0;
{ {
std::unique_lock<std::mutex> l(m_InboundTunnelsMutex); std::unique_lock<std::mutex> l(m_OutboundTunnelsMutex);
for (const auto& it : m_InboundTunnels) for (const auto& it : m_OutboundTunnels)
if (it->IsEstablished ()) num++; if (it->IsEstablished ()) num++;
} }
for (int i = num; i < m_NumInboundTunnels; i++) for (int i = num; i < m_NumOutboundTunnels; i++)
CreateInboundTunnel (); CreateOutboundTunnel ();
num = 0; num = 0;
{ {
std::unique_lock<std::mutex> l(m_OutboundTunnelsMutex); std::unique_lock<std::mutex> l(m_InboundTunnelsMutex);
for (const auto& it : m_OutboundTunnels) for (const auto& it : m_InboundTunnels)
if (it->IsEstablished ()) num++; if (it->IsEstablished ()) num++;
} }
for (int i = num; i < m_NumOutboundTunnels; i++) for (int i = num; i < m_NumInboundTunnels; i++)
CreateOutboundTunnel (); CreateInboundTunnel ();
if (num > 0 && m_NumInboundHops <= 0 && m_LocalDestination) // zero hops IB
m_LocalDestination->SetLeaseSetUpdated (); // update LeaseSet immediately
} }
void TunnelPool::TestTunnels () void TunnelPool::TestTunnels ()

Loading…
Cancel
Save