mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
use shared_ptr for I2NP messages through tunnels
This commit is contained in:
parent
122b8c2a84
commit
4ed7e29896
16 changed files with 75 additions and 127 deletions
|
@ -40,7 +40,7 @@ namespace tunnel
|
|||
di[0] = block.deliveryType << 5; // set delivery type
|
||||
|
||||
// create fragments
|
||||
I2NPMessage * msg = block.data;
|
||||
std::shared_ptr<I2NPMessage> msg = block.data;
|
||||
auto fullMsgLen = diLen + msg->GetLength () + 2; // delivery instructions + payload + 2 bytes length
|
||||
if (fullMsgLen <= m_RemainingSize)
|
||||
{
|
||||
|
@ -53,7 +53,6 @@ namespace tunnel
|
|||
m_RemainingSize -= diLen + msg->GetLength ();
|
||||
if (!m_RemainingSize)
|
||||
CompleteCurrentTunnelDataMessage ();
|
||||
DeleteI2NPMessage (msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -117,7 +116,6 @@ namespace tunnel
|
|||
size += s;
|
||||
fragmentNumber++;
|
||||
}
|
||||
DeleteI2NPMessage (msg);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -190,7 +188,7 @@ namespace tunnel
|
|||
auto tunnelMsgs = m_Buffer.GetTunnelDataMsgs ();
|
||||
for (auto tunnelMsg : tunnelMsgs)
|
||||
{
|
||||
m_Tunnel->EncryptTunnelMsg (tunnelMsg.get ()); // TODO:
|
||||
m_Tunnel->EncryptTunnelMsg (tunnelMsg);
|
||||
FillI2NPMessageHeader (tunnelMsg.get (), eI2NPTunnelData); // TODO:
|
||||
m_NumSentBytes += TUNNEL_DATA_MSG_SIZE;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue