mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-02-08 22:13:48 +01:00
create shared I2NP tunnel message in OBGW
This commit is contained in:
parent
25a163cdeb
commit
5ca86b87f5
2 changed files with 7 additions and 8 deletions
|
@ -12,8 +12,6 @@ namespace tunnel
|
||||||
{
|
{
|
||||||
TunnelGatewayBuffer::~TunnelGatewayBuffer ()
|
TunnelGatewayBuffer::~TunnelGatewayBuffer ()
|
||||||
{
|
{
|
||||||
for (auto it: m_TunnelDataMsgs)
|
|
||||||
DeleteI2NPMessage (it);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TunnelGatewayBuffer::PutI2NPMsg (const TunnelMessageBlock& block)
|
void TunnelGatewayBuffer::PutI2NPMsg (const TunnelMessageBlock& block)
|
||||||
|
@ -138,7 +136,7 @@ namespace tunnel
|
||||||
|
|
||||||
void TunnelGatewayBuffer::CreateCurrentTunnelDataMessage ()
|
void TunnelGatewayBuffer::CreateCurrentTunnelDataMessage ()
|
||||||
{
|
{
|
||||||
m_CurrentTunnelDataMsg = NewI2NPShortMessage ();
|
m_CurrentTunnelDataMsg = ToSharedI2NPMessage (NewI2NPShortMessage ());
|
||||||
m_CurrentTunnelDataMsg->Align (12);
|
m_CurrentTunnelDataMsg->Align (12);
|
||||||
// we reserve space for padding
|
// we reserve space for padding
|
||||||
m_CurrentTunnelDataMsg->offset += TUNNEL_DATA_MSG_SIZE + I2NP_HEADER_SIZE;
|
m_CurrentTunnelDataMsg->offset += TUNNEL_DATA_MSG_SIZE + I2NP_HEADER_SIZE;
|
||||||
|
@ -192,8 +190,8 @@ namespace tunnel
|
||||||
auto tunnelMsgs = m_Buffer.GetTunnelDataMsgs ();
|
auto tunnelMsgs = m_Buffer.GetTunnelDataMsgs ();
|
||||||
for (auto tunnelMsg : tunnelMsgs)
|
for (auto tunnelMsg : tunnelMsgs)
|
||||||
{
|
{
|
||||||
m_Tunnel->EncryptTunnelMsg (tunnelMsg);
|
m_Tunnel->EncryptTunnelMsg (tunnelMsg.get ()); // TODO:
|
||||||
FillI2NPMessageHeader (tunnelMsg, eI2NPTunnelData);
|
FillI2NPMessageHeader (tunnelMsg.get (), eI2NPTunnelData); // TODO:
|
||||||
m_NumSentBytes += TUNNEL_DATA_MSG_SIZE;
|
m_NumSentBytes += TUNNEL_DATA_MSG_SIZE;
|
||||||
}
|
}
|
||||||
i2p::transport::transports.SendMessages (m_Tunnel->GetNextIdentHash (), tunnelMsgs);
|
i2p::transport::transports.SendMessages (m_Tunnel->GetNextIdentHash (), tunnelMsgs);
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
#include <inttypes.h>
|
#include <inttypes.h>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <memory>
|
||||||
#include "I2NPProtocol.h"
|
#include "I2NPProtocol.h"
|
||||||
#include "TunnelBase.h"
|
#include "TunnelBase.h"
|
||||||
|
|
||||||
|
@ -17,7 +18,7 @@ namespace tunnel
|
||||||
m_CurrentTunnelDataMsg (nullptr), m_RemainingSize (0) {};
|
m_CurrentTunnelDataMsg (nullptr), m_RemainingSize (0) {};
|
||||||
~TunnelGatewayBuffer ();
|
~TunnelGatewayBuffer ();
|
||||||
void PutI2NPMsg (const TunnelMessageBlock& block);
|
void PutI2NPMsg (const TunnelMessageBlock& block);
|
||||||
const std::vector<I2NPMessage *>& GetTunnelDataMsgs () const { return m_TunnelDataMsgs; };
|
const std::vector<std::shared_ptr<I2NPMessage> >& GetTunnelDataMsgs () const { return m_TunnelDataMsgs; };
|
||||||
void ClearTunnelDataMsgs ();
|
void ClearTunnelDataMsgs ();
|
||||||
void CompleteCurrentTunnelDataMessage ();
|
void CompleteCurrentTunnelDataMessage ();
|
||||||
|
|
||||||
|
@ -28,8 +29,8 @@ namespace tunnel
|
||||||
private:
|
private:
|
||||||
|
|
||||||
uint32_t m_TunnelID;
|
uint32_t m_TunnelID;
|
||||||
std::vector<I2NPMessage *> m_TunnelDataMsgs;
|
std::vector<std::shared_ptr<I2NPMessage> > m_TunnelDataMsgs;
|
||||||
I2NPMessage * m_CurrentTunnelDataMsg;
|
std::shared_ptr<I2NPMessage> m_CurrentTunnelDataMsg;
|
||||||
size_t m_RemainingSize;
|
size_t m_RemainingSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue