From 87f46e3da3e331b47f51a938446608edad042cce Mon Sep 17 00:00:00 2001 From: PobreGato <315121269+pobregat0@users.noreply.github.com> Date: Sun, 30 Aug 2026 12:13:38 +0300 Subject: [PATCH] own BOB proxy tunnels by shared_ptr --- libi2pd_client/BOB.cpp | 6 +++--- libi2pd_client/BOB.h | 5 +++-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/libi2pd_client/BOB.cpp b/libi2pd_client/BOB.cpp index 3b418707..89756e9f 100644 --- a/libi2pd_client/BOB.cpp +++ b/libi2pd_client/BOB.cpp @@ -507,7 +507,7 @@ namespace client case TunnelType::SOCKS: try { - auto SocksProxy = std::make_unique(m_Nickname, m_InHost, m_InPort, + auto SocksProxy = std::make_shared(m_Nickname, m_InHost, m_InPort, false, m_OutHost, m_OutPort, m_CurrentDestination->GetLocalDestination()); SocksProxy->Start(); m_Owner.SetProxy(m_Nickname, std::move(SocksProxy)); @@ -521,7 +521,7 @@ namespace client case TunnelType::HTTP_PROXY: try { - auto HttpProxy = std::make_unique(m_Nickname, m_InHost, m_InPort, + auto HttpProxy = std::make_shared(m_Nickname, m_InHost, m_InPort, m_OutHost, true, true, m_CurrentDestination->GetLocalDestination()); HttpProxy->Start(); m_Owner.SetProxy(m_Nickname, std::move(HttpProxy)); @@ -1113,7 +1113,7 @@ namespace client return nullptr; } - void BOBCommandChannel::SetProxy (const std::string& name, std::unique_ptr proxy) + void BOBCommandChannel::SetProxy (const std::string& name, std::shared_ptr proxy) { m_proxy[name] = std::move(proxy); } diff --git a/libi2pd_client/BOB.h b/libi2pd_client/BOB.h index 429fbfd6..c215f7cf 100644 --- a/libi2pd_client/BOB.h +++ b/libi2pd_client/BOB.h @@ -299,7 +299,7 @@ namespace client void AddDestination (const std::string& name, std::shared_ptr dest); void DeleteDestination (const std::string& name); std::shared_ptr FindDestination (const std::string& name); - void SetProxy (const std::string& name, std::unique_ptr proxy); + void SetProxy (const std::string& name, std::shared_ptr proxy); const I2PService* GetProxy(const std::string& name) const; void RemoveProxy(const std::string& name); @@ -314,7 +314,8 @@ namespace client std::map > m_Destinations; std::map m_CommandHandlers; std::map m_HelpStrings; - std::map> m_proxy; + // shared, a proxy takes a reference to itself when it accepts a connection + std::map> m_proxy; public: