mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-05 05:44:13 +00:00
bind streaming destination to port for server tunnel
This commit is contained in:
parent
6fc0b2ecfb
commit
c66ba370d5
@ -246,6 +246,7 @@ namespace client
|
|||||||
I2PServerTunnel::I2PServerTunnel (const std::string& address, int port, std::shared_ptr<ClientDestination> localDestination):
|
I2PServerTunnel::I2PServerTunnel (const std::string& address, int port, std::shared_ptr<ClientDestination> localDestination):
|
||||||
I2PService (localDestination), m_Endpoint (boost::asio::ip::address::from_string (address), port)
|
I2PService (localDestination), m_Endpoint (boost::asio::ip::address::from_string (address), port)
|
||||||
{
|
{
|
||||||
|
m_PortDestination = localDestination->CreateStreamingDestination (port);
|
||||||
}
|
}
|
||||||
|
|
||||||
void I2PServerTunnel::Start ()
|
void I2PServerTunnel::Start ()
|
||||||
@ -260,9 +261,15 @@ namespace client
|
|||||||
|
|
||||||
void I2PServerTunnel::Accept ()
|
void I2PServerTunnel::Accept ()
|
||||||
{
|
{
|
||||||
|
if (m_PortDestination)
|
||||||
|
m_PortDestination->SetAcceptor (std::bind (&I2PServerTunnel::HandleAccept, this, std::placeholders::_1));
|
||||||
|
|
||||||
auto localDestination = GetLocalDestination ();
|
auto localDestination = GetLocalDestination ();
|
||||||
if (localDestination)
|
if (localDestination)
|
||||||
localDestination->AcceptStreams (std::bind (&I2PServerTunnel::HandleAccept, this, std::placeholders::_1));
|
{
|
||||||
|
if (!localDestination->IsAcceptingStreams ()) // set it as default if not set yet
|
||||||
|
localDestination->AcceptStreams (std::bind (&I2PServerTunnel::HandleAccept, this, std::placeholders::_1));
|
||||||
|
}
|
||||||
else
|
else
|
||||||
LogPrint ("Local destination not set for server tunnel");
|
LogPrint ("Local destination not set for server tunnel");
|
||||||
}
|
}
|
||||||
|
@ -95,7 +95,8 @@ namespace client
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
boost::asio::ip::tcp::endpoint m_Endpoint;
|
boost::asio::ip::tcp::endpoint m_Endpoint;
|
||||||
|
std::shared_ptr<i2p::stream::StreamingDestination> m_PortDestination;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user