mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-24 09:56:35 +02:00
check send frame error code
This commit is contained in:
parent
a2c41c9e36
commit
6d46fc9f9f
1 changed files with 28 additions and 10 deletions
|
@ -464,10 +464,18 @@ namespace transport
|
|||
LogPrint (eLogDebug, "NTCP2: padding length ", paddingLen);
|
||||
// TODO: check tsB
|
||||
if (paddingLen > 0)
|
||||
{
|
||||
if (paddingLen <= 287 - 64) // session created is 287 bytes max
|
||||
{
|
||||
boost::asio::async_read (m_Socket, boost::asio::buffer(m_Establisher->m_SessionCreatedBuffer + 64, paddingLen), boost::asio::transfer_all (),
|
||||
std::bind(&NTCP2Session::HandleSessionCreatedPaddingReceived, shared_from_this (), std::placeholders::_1, std::placeholders::_2));
|
||||
}
|
||||
else
|
||||
{
|
||||
LogPrint (eLogWarning, "NTCP2: SessionCreated padding length ", (int)paddingLen, " is too long");
|
||||
Terminate ();
|
||||
}
|
||||
}
|
||||
else
|
||||
SendSessionConfirmed ();
|
||||
}
|
||||
|
@ -677,6 +685,7 @@ namespace transport
|
|||
{
|
||||
if (ecode)
|
||||
{
|
||||
if (ecode != boost::asio::error::operation_aborted)
|
||||
LogPrint (eLogWarning, "NTCP2: receive length read error: ", ecode.message ());
|
||||
Terminate ();
|
||||
}
|
||||
|
@ -702,6 +711,7 @@ namespace transport
|
|||
{
|
||||
if (ecode)
|
||||
{
|
||||
if (ecode != boost::asio::error::operation_aborted)
|
||||
LogPrint (eLogWarning, "NTCP2: receive read error: ", ecode.message ());
|
||||
Terminate ();
|
||||
}
|
||||
|
@ -804,15 +814,23 @@ namespace transport
|
|||
}
|
||||
|
||||
void NTCP2Session::HandleNextFrameSent (const boost::system::error_code& ecode, std::size_t bytes_transferred)
|
||||
{
|
||||
m_IsSending = false;
|
||||
delete[] m_NextSendBuffer; m_NextSendBuffer = nullptr;
|
||||
|
||||
if (ecode)
|
||||
{
|
||||
LogPrint (eLogWarning, "NTCP2: Couldn't send frame ", ecode.message ());
|
||||
}
|
||||
else
|
||||
{
|
||||
m_LastActivityTimestamp = i2p::util::GetSecondsSinceEpoch ();
|
||||
m_NumSentBytes += bytes_transferred;
|
||||
i2p::transport::transports.UpdateSentBytes (bytes_transferred);
|
||||
delete[] m_NextSendBuffer; m_NextSendBuffer = nullptr;
|
||||
LogPrint (eLogDebug, "NTCP2: Next frame sent");
|
||||
m_IsSending = false;
|
||||
SendQueue ();
|
||||
}
|
||||
}
|
||||
|
||||
void NTCP2Session::SendQueue ()
|
||||
{
|
||||
|
|
Loading…
Add table
Reference in a new issue