From af20b13c7a54a852a16024111714d17585aecdee Mon Sep 17 00:00:00 2001 From: orignal Date: Sun, 15 Nov 2020 17:02:01 -0500 Subject: [PATCH] create paired inbound tunnels if no inbound tunnels yet --- libi2pd/TunnelPool.cpp | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/libi2pd/TunnelPool.cpp b/libi2pd/TunnelPool.cpp index d0fd401f..909248ba 100644 --- a/libi2pd/TunnelPool.cpp +++ b/libi2pd/TunnelPool.cpp @@ -118,7 +118,6 @@ namespace tunnel std::unique_lock l(m_OutboundTunnelsMutex); m_OutboundTunnels.insert (createdTunnel); } - //CreatePairedInboundTunnel (createdTunnel); } void TunnelPool::TunnelExpired (std::shared_ptr expiredTunnel) @@ -235,6 +234,15 @@ namespace tunnel for (const auto& it : m_InboundTunnels) if (it->IsEstablished ()) num++; } + if (!num && !m_OutboundTunnels.empty ()) + { + for (auto it: m_OutboundTunnels) + { + CreatePairedInboundTunnel (it); + num++; + if (num >= m_NumInboundTunnels) break; + } + } for (int i = num; i < m_NumInboundTunnels; i++) CreateInboundTunnel ();