own BOB proxy tunnels by shared_ptr

This commit is contained in:
PobreGato
2026-08-30 12:13:38 +03:00
parent 9199cfc7ea
commit 87f46e3da3
2 changed files with 6 additions and 5 deletions
+3 -3
View File
@@ -507,7 +507,7 @@ namespace client
case TunnelType::SOCKS:
try
{
auto SocksProxy = std::make_unique<i2p::proxy::SOCKSProxy>(m_Nickname, m_InHost, m_InPort,
auto SocksProxy = std::make_shared<i2p::proxy::SOCKSProxy>(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<i2p::proxy::HTTPProxy>(m_Nickname, m_InHost, m_InPort,
auto HttpProxy = std::make_shared<i2p::proxy::HTTPProxy>(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<I2PService> proxy)
void BOBCommandChannel::SetProxy (const std::string& name, std::shared_ptr<I2PService> proxy)
{
m_proxy[name] = std::move(proxy);
}
+3 -2
View File
@@ -299,7 +299,7 @@ namespace client
void AddDestination (const std::string& name, std::shared_ptr<BOBDestination> dest);
void DeleteDestination (const std::string& name);
std::shared_ptr<BOBDestination> FindDestination (const std::string& name);
void SetProxy (const std::string& name, std::unique_ptr<I2PService> proxy);
void SetProxy (const std::string& name, std::shared_ptr<I2PService> proxy);
const I2PService* GetProxy(const std::string& name) const;
void RemoveProxy(const std::string& name);
@@ -314,7 +314,8 @@ namespace client
std::map<std::string, std::shared_ptr<BOBDestination> > m_Destinations;
std::map<std::string_view, BOBCommandHandler> m_CommandHandlers;
std::map<std::string_view, std::string_view> m_HelpStrings;
std::map<std::string, std::unique_ptr<I2PService>> m_proxy;
// shared, a proxy takes a reference to itself when it accepts a connection
std::map<std::string, std::shared_ptr<I2PService>> m_proxy;
public: