mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 21:37:17 +01:00
make sure only one I2P tunnel per local prot
This commit is contained in:
parent
242bc3624a
commit
ed692ffba3
|
@ -54,9 +54,10 @@ namespace client
|
||||||
std::string ircKeys = i2p::util::config::GetArg("-irckeys", "");
|
std::string ircKeys = i2p::util::config::GetArg("-irckeys", "");
|
||||||
if (ircKeys.length () > 0)
|
if (ircKeys.length () > 0)
|
||||||
localDestination = LoadLocalDestination (ircKeys, false);
|
localDestination = LoadLocalDestination (ircKeys, false);
|
||||||
auto ircTunnel = new I2PClientTunnel (ircDestination, i2p::util::config::GetArg("-ircport", 6668), localDestination);
|
auto ircPort = i2p::util::config::GetArg("-ircport", 6668);
|
||||||
|
auto ircTunnel = new I2PClientTunnel (ircDestination, ircPort, localDestination);
|
||||||
ircTunnel->Start ();
|
ircTunnel->Start ();
|
||||||
m_ClientTunnels.push_back (std::unique_ptr<I2PClientTunnel>(ircTunnel));
|
m_ClientTunnels.insert (std::make_pair(ircPort, std::unique_ptr<I2PClientTunnel>(ircTunnel)));
|
||||||
LogPrint("IRC tunnel started");
|
LogPrint("IRC tunnel started");
|
||||||
}
|
}
|
||||||
std::string eepKeys = i2p::util::config::GetArg("-eepkeys", "");
|
std::string eepKeys = i2p::util::config::GetArg("-eepkeys", "");
|
||||||
|
@ -112,8 +113,8 @@ namespace client
|
||||||
LogPrint("SOCKS Proxy stopped");
|
LogPrint("SOCKS Proxy stopped");
|
||||||
for (auto& it: m_ClientTunnels)
|
for (auto& it: m_ClientTunnels)
|
||||||
{
|
{
|
||||||
it->Stop ();
|
it.second->Stop ();
|
||||||
LogPrint("I2P client tunnel stopped");
|
LogPrint("I2P client tunnel on port ", it.first, " stopped");
|
||||||
}
|
}
|
||||||
m_ClientTunnels.clear ();
|
m_ClientTunnels.clear ();
|
||||||
if (m_ServerTunnel)
|
if (m_ServerTunnel)
|
||||||
|
@ -287,8 +288,10 @@ namespace client
|
||||||
if (keys[i].length () > 0)
|
if (keys[i].length () > 0)
|
||||||
localDestination = LoadLocalDestination (keys[i], false);
|
localDestination = LoadLocalDestination (keys[i], false);
|
||||||
auto clientTunnel = new I2PClientTunnel (destinations[i], ports[i], localDestination);
|
auto clientTunnel = new I2PClientTunnel (destinations[i], ports[i], localDestination);
|
||||||
clientTunnel->Start ();
|
if (m_ClientTunnels.insert (std::make_pair (ports[i], std::unique_ptr<I2PClientTunnel>(clientTunnel))).second)
|
||||||
m_ClientTunnels.push_back (std::unique_ptr<I2PClientTunnel>(clientTunnel));
|
clientTunnel->Start ();
|
||||||
|
else
|
||||||
|
LogPrint (eLogError, "I2P client tunnel with port ", ports[i], " already exists");
|
||||||
}
|
}
|
||||||
LogPrint (eLogInfo, numClientTunnels, " I2P client tunnels created");
|
LogPrint (eLogInfo, numClientTunnels, " I2P client tunnels created");
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
#ifndef CLIENT_CONTEXT_H__
|
#ifndef CLIENT_CONTEXT_H__
|
||||||
#define CLIENT_CONTEXT_H__
|
#define CLIENT_CONTEXT_H__
|
||||||
|
|
||||||
#include <list>
|
#include <map>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include "Destination.h"
|
#include "Destination.h"
|
||||||
|
@ -58,7 +58,7 @@ namespace client
|
||||||
|
|
||||||
i2p::proxy::HTTPProxy * m_HttpProxy;
|
i2p::proxy::HTTPProxy * m_HttpProxy;
|
||||||
i2p::proxy::SOCKSProxy * m_SocksProxy;
|
i2p::proxy::SOCKSProxy * m_SocksProxy;
|
||||||
std::list<std::unique_ptr<I2PClientTunnel> > m_ClientTunnels;
|
std::map<int, std::unique_ptr<I2PClientTunnel> > m_ClientTunnels; // port->tunnel
|
||||||
I2PServerTunnel * m_ServerTunnel;
|
I2PServerTunnel * m_ServerTunnel;
|
||||||
SAMBridge * m_SamBridge;
|
SAMBridge * m_SamBridge;
|
||||||
BOBCommandChannel * m_BOBCommandChannel;
|
BOBCommandChannel * m_BOBCommandChannel;
|
||||||
|
|
Loading…
Reference in a new issue