mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-27 11:17:49 +02:00
always use destination's thread to avoid race conditions
This commit is contained in:
parent
e8c544c774
commit
4d640dac2a
5 changed files with 29 additions and 40 deletions
22
BOB.cpp
22
BOB.cpp
|
@ -8,10 +8,9 @@ namespace i2p
|
|||
{
|
||||
namespace client
|
||||
{
|
||||
BOBI2PInboundTunnel::BOBI2PInboundTunnel (boost::asio::io_service& service, int port, ClientDestination * localDestination):
|
||||
BOBI2PTunnel (service, localDestination),
|
||||
m_Acceptor (service, boost::asio::ip::tcp::endpoint (boost::asio::ip::tcp::v4(), port)),
|
||||
m_Timer (service)
|
||||
BOBI2PInboundTunnel::BOBI2PInboundTunnel (int port, ClientDestination * localDestination):
|
||||
BOBI2PTunnel (localDestination),
|
||||
m_Acceptor (localDestination->GetService (), boost::asio::ip::tcp::endpoint (boost::asio::ip::tcp::v4(), port)), m_Timer (localDestination->GetService ())
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -142,8 +141,8 @@ namespace client
|
|||
delete receiver;
|
||||
}
|
||||
|
||||
BOBI2POutboundTunnel::BOBI2POutboundTunnel (boost::asio::io_service& service, const std::string& address, int port,
|
||||
ClientDestination * localDestination, bool quiet): BOBI2PTunnel (service, localDestination),
|
||||
BOBI2POutboundTunnel::BOBI2POutboundTunnel (const std::string& address, int port,
|
||||
ClientDestination * localDestination, bool quiet): BOBI2PTunnel (localDestination),
|
||||
m_Endpoint (boost::asio::ip::address::from_string (address), port), m_IsQuiet (quiet)
|
||||
{
|
||||
}
|
||||
|
@ -177,8 +176,8 @@ namespace client
|
|||
}
|
||||
}
|
||||
|
||||
BOBDestination::BOBDestination (boost::asio::io_service& service, ClientDestination& localDestination):
|
||||
m_Service (service), m_LocalDestination (localDestination),
|
||||
BOBDestination::BOBDestination (ClientDestination& localDestination):
|
||||
m_LocalDestination (localDestination),
|
||||
m_OutboundTunnel (nullptr), m_InboundTunnel (nullptr)
|
||||
{
|
||||
}
|
||||
|
@ -220,13 +219,13 @@ namespace client
|
|||
void BOBDestination::CreateInboundTunnel (int port)
|
||||
{
|
||||
if (!m_InboundTunnel)
|
||||
m_InboundTunnel = new BOBI2PInboundTunnel (m_Service, port, &m_LocalDestination);
|
||||
m_InboundTunnel = new BOBI2PInboundTunnel (port, &m_LocalDestination);
|
||||
}
|
||||
|
||||
void BOBDestination::CreateOutboundTunnel (const std::string& address, int port, bool quiet)
|
||||
{
|
||||
if (!m_OutboundTunnel)
|
||||
m_OutboundTunnel = new BOBI2POutboundTunnel (m_Service, address, port, &m_LocalDestination, quiet);
|
||||
m_OutboundTunnel = new BOBI2POutboundTunnel (address, port, &m_LocalDestination, quiet);
|
||||
}
|
||||
|
||||
BOBCommandSession::BOBCommandSession (BOBCommandChannel& owner):
|
||||
|
@ -384,8 +383,7 @@ namespace client
|
|||
LogPrint (eLogDebug, "BOB: start ", m_Nickname);
|
||||
if (!m_CurrentDestination)
|
||||
{
|
||||
m_CurrentDestination = new BOBDestination (m_Owner.GetService (),
|
||||
*context.CreateNewLocalDestination (m_Keys, true, &m_Options));
|
||||
m_CurrentDestination = new BOBDestination (*i2p::client::context.CreateNewLocalDestination (m_Keys, true, &m_Options));
|
||||
m_Owner.AddDestination (m_Nickname, m_CurrentDestination);
|
||||
}
|
||||
if (m_InPort)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue