mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-05-04 22:48:40 +02:00
probing resistance
Some checks are pending
Build Debian packages / bookworm (push) Waiting to run
Build Debian packages / bullseye (push) Waiting to run
Build Debian packages / buster (push) Waiting to run
Build on FreeBSD / with UPnP (push) Waiting to run
Build on OSX / With USE_UPNP=no (push) Waiting to run
Build on OSX / With USE_UPNP=yes (push) Waiting to run
Build on Windows / clang-x86_64 (push) Waiting to run
Build on Windows / i686 (push) Waiting to run
Build on Windows / ucrt-x86_64 (push) Waiting to run
Build on Windows / x86_64 (push) Waiting to run
Build on Windows / CMake clang-x86_64 (push) Waiting to run
Build on Windows / CMake i686 (push) Waiting to run
Build on Windows / CMake ucrt-x86_64 (push) Waiting to run
Build on Windows / CMake x86_64 (push) Waiting to run
Build on Windows / XP (push) Waiting to run
Build on Ubuntu / Make with USE_UPNP=no (push) Waiting to run
Build on Ubuntu / Make with USE_UPNP=yes (push) Waiting to run
Build on Ubuntu / CMake with -DWITH_UPNP=OFF (push) Waiting to run
Build on Ubuntu / CMake with -DWITH_UPNP=ON (push) Waiting to run
Build containers / Building container for linux/amd64 (push) Waiting to run
Build containers / Building container for linux/arm64 (push) Waiting to run
Build containers / Building container for linux/arm/v7 (push) Waiting to run
Build containers / Building container for linux/386 (push) Waiting to run
Build containers / Pushing merged manifest (push) Blocked by required conditions
Some checks are pending
Build Debian packages / bookworm (push) Waiting to run
Build Debian packages / bullseye (push) Waiting to run
Build Debian packages / buster (push) Waiting to run
Build on FreeBSD / with UPnP (push) Waiting to run
Build on OSX / With USE_UPNP=no (push) Waiting to run
Build on OSX / With USE_UPNP=yes (push) Waiting to run
Build on Windows / clang-x86_64 (push) Waiting to run
Build on Windows / i686 (push) Waiting to run
Build on Windows / ucrt-x86_64 (push) Waiting to run
Build on Windows / x86_64 (push) Waiting to run
Build on Windows / CMake clang-x86_64 (push) Waiting to run
Build on Windows / CMake i686 (push) Waiting to run
Build on Windows / CMake ucrt-x86_64 (push) Waiting to run
Build on Windows / CMake x86_64 (push) Waiting to run
Build on Windows / XP (push) Waiting to run
Build on Ubuntu / Make with USE_UPNP=no (push) Waiting to run
Build on Ubuntu / Make with USE_UPNP=yes (push) Waiting to run
Build on Ubuntu / CMake with -DWITH_UPNP=OFF (push) Waiting to run
Build on Ubuntu / CMake with -DWITH_UPNP=ON (push) Waiting to run
Build containers / Building container for linux/amd64 (push) Waiting to run
Build containers / Building container for linux/arm64 (push) Waiting to run
Build containers / Building container for linux/arm/v7 (push) Waiting to run
Build containers / Building container for linux/386 (push) Waiting to run
Build containers / Pushing merged manifest (push) Blocked by required conditions
This commit is contained in:
parent
aece5bb16c
commit
0d278d2ae5
2 changed files with 17 additions and 3 deletions
|
@ -528,6 +528,7 @@ namespace transport
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
m_Establisher->CreateEphemeralKey ();
|
||||||
boost::asio::post (m_Server.GetEstablisherService (),
|
boost::asio::post (m_Server.GetEstablisherService (),
|
||||||
[s = shared_from_this (), bytes_transferred] ()
|
[s = shared_from_this (), bytes_transferred] ()
|
||||||
{
|
{
|
||||||
|
@ -566,7 +567,7 @@ namespace transport
|
||||||
SendSessionCreated ();
|
SendSessionCreated ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
boost::asio::post (m_Server.GetService (), std::bind (&NTCP2Session::Terminate, shared_from_this ()));
|
ReadSomethingAndTerminate (); // probing resistance
|
||||||
}
|
}
|
||||||
|
|
||||||
void NTCP2Session::HandleSessionRequestPaddingReceived (const boost::system::error_code& ecode, std::size_t bytes_transferred)
|
void NTCP2Session::HandleSessionRequestPaddingReceived (const boost::system::error_code& ecode, std::size_t bytes_transferred)
|
||||||
|
@ -918,7 +919,6 @@ namespace transport
|
||||||
{
|
{
|
||||||
SetTerminationTimeout (NTCP2_ESTABLISH_TIMEOUT);
|
SetTerminationTimeout (NTCP2_ESTABLISH_TIMEOUT);
|
||||||
SetLastActivityTimestamp (i2p::util::GetSecondsSinceEpoch ());
|
SetLastActivityTimestamp (i2p::util::GetSecondsSinceEpoch ());
|
||||||
m_Establisher->CreateEphemeralKey ();
|
|
||||||
boost::asio::async_read (m_Socket, boost::asio::buffer(m_Establisher->m_SessionRequestBuffer, 64), boost::asio::transfer_all (),
|
boost::asio::async_read (m_Socket, boost::asio::buffer(m_Establisher->m_SessionRequestBuffer, 64), boost::asio::transfer_all (),
|
||||||
std::bind(&NTCP2Session::HandleSessionRequestReceived, shared_from_this (),
|
std::bind(&NTCP2Session::HandleSessionRequestReceived, shared_from_this (),
|
||||||
std::placeholders::_1, std::placeholders::_2));
|
std::placeholders::_1, std::placeholders::_2));
|
||||||
|
@ -1399,6 +1399,19 @@ namespace transport
|
||||||
boost::asio::post (m_Server.GetService (), std::bind (&NTCP2Session::Terminate, shared_from_this ())); // let termination message go
|
boost::asio::post (m_Server.GetService (), std::bind (&NTCP2Session::Terminate, shared_from_this ())); // let termination message go
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NTCP2Session::ReadSomethingAndTerminate ()
|
||||||
|
{
|
||||||
|
size_t len = m_Server.GetRng ()() % NTCP2_SESSION_REQUEST_MAX_SIZE;
|
||||||
|
if (len > 0 && m_Establisher)
|
||||||
|
boost::asio::async_read (m_Socket, boost::asio::buffer(m_Establisher->m_SessionRequestBuffer, len), boost::asio::transfer_all (),
|
||||||
|
[s = shared_from_this()](const boost::system::error_code& ecode, size_t bytes_transferred)
|
||||||
|
{
|
||||||
|
s->Terminate ();
|
||||||
|
});
|
||||||
|
else
|
||||||
|
boost::asio::post (m_Server.GetService (), std::bind (&NTCP2Session::Terminate, shared_from_this ()));
|
||||||
|
}
|
||||||
|
|
||||||
void NTCP2Session::SendI2NPMessages (std::list<std::shared_ptr<I2NPMessage> >& msgs)
|
void NTCP2Session::SendI2NPMessages (std::list<std::shared_ptr<I2NPMessage> >& msgs)
|
||||||
{
|
{
|
||||||
if (m_IsTerminated || msgs.empty ())
|
if (m_IsTerminated || msgs.empty ())
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2013-2024, The PurpleI2P Project
|
* Copyright (c) 2013-2025, The PurpleI2P Project
|
||||||
*
|
*
|
||||||
* This file is part of Purple i2pd project and licensed under BSD3
|
* This file is part of Purple i2pd project and licensed under BSD3
|
||||||
*
|
*
|
||||||
|
@ -200,6 +200,7 @@ namespace transport
|
||||||
void SendRouterInfo ();
|
void SendRouterInfo ();
|
||||||
void SendTermination (NTCP2TerminationReason reason);
|
void SendTermination (NTCP2TerminationReason reason);
|
||||||
void SendTerminationAndTerminate (NTCP2TerminationReason reason);
|
void SendTerminationAndTerminate (NTCP2TerminationReason reason);
|
||||||
|
void ReadSomethingAndTerminate ();
|
||||||
void PostI2NPMessages ();
|
void PostI2NPMessages ();
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue