mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
connect to SSU2 address
This commit is contained in:
parent
7473d8c9aa
commit
3c5c375f71
5 changed files with 96 additions and 32 deletions
|
@ -48,6 +48,11 @@ namespace transport
|
|||
{
|
||||
}
|
||||
|
||||
void SSU2Session::Connect ()
|
||||
{
|
||||
SendSessionRequest ();
|
||||
}
|
||||
|
||||
void SSU2Session::SendSessionRequest ()
|
||||
{
|
||||
// we are Alice
|
||||
|
@ -488,6 +493,21 @@ namespace transport
|
|||
boost::system::error_code ec;
|
||||
m_Socket.send_to (bufs, to, 0, ec);
|
||||
}
|
||||
|
||||
|
||||
bool SSU2Server::CreateSession (std::shared_ptr<const i2p::data::RouterInfo> router,
|
||||
std::shared_ptr<const i2p::data::RouterInfo::Address> address)
|
||||
{
|
||||
if (router && address)
|
||||
GetService ().post (
|
||||
[this, router, address]()
|
||||
{
|
||||
auto session = std::make_shared<SSU2Session> (*this, router, address);
|
||||
session->Connect ();
|
||||
});
|
||||
else
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue