mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
don't allocate payload buffer for every single ECIESx25519 message
This commit is contained in:
parent
a37cf058cd
commit
6ecfe0789f
4 changed files with 57 additions and 41 deletions
|
@ -433,7 +433,7 @@ namespace garlic
|
|||
}
|
||||
|
||||
GarlicDestination::GarlicDestination (): m_NumTags (32), // 32 tags by default
|
||||
m_NumRatchetInboundTags (0) // 0 means standard
|
||||
m_PayloadBuffer (nullptr), m_NumRatchetInboundTags (0) // 0 means standard
|
||||
{
|
||||
m_Ctx = BN_CTX_new ();
|
||||
}
|
||||
|
@ -441,6 +441,8 @@ namespace garlic
|
|||
GarlicDestination::~GarlicDestination ()
|
||||
{
|
||||
BN_CTX_free (m_Ctx);
|
||||
if (m_PayloadBuffer)
|
||||
delete[] m_PayloadBuffer;
|
||||
}
|
||||
|
||||
void GarlicDestination::CleanUp ()
|
||||
|
@ -1121,5 +1123,12 @@ namespace garlic
|
|||
m_ECIESx25519Sessions.erase (it);
|
||||
}
|
||||
}
|
||||
|
||||
uint8_t * GarlicDestination::GetPayloadBuffer ()
|
||||
{
|
||||
if (!m_PayloadBuffer)
|
||||
m_PayloadBuffer = new uint8_t[I2NP_MAX_MESSAGE_SIZE];
|
||||
return m_PayloadBuffer;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue