From 40e6d675c591527800419733530ff8e9e74125fd Mon Sep 17 00:00:00 2001 From: orignal Date: Tue, 25 Jan 2022 13:02:27 -0500 Subject: [PATCH] I2NP messages pool for I2CP --- libi2pd_client/I2CP.cpp | 2 +- libi2pd_client/I2CP.h | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/libi2pd_client/I2CP.cpp b/libi2pd_client/I2CP.cpp index 7552c6c5..43c891d5 100644 --- a/libi2pd_client/I2CP.cpp +++ b/libi2pd_client/I2CP.cpp @@ -146,7 +146,7 @@ namespace client void I2CPDestination::SendMsgTo (const uint8_t * payload, size_t len, const i2p::data::IdentHash& ident, uint32_t nonce) { - auto msg = NewI2NPMessage (); + auto msg = m_I2NPMsgsPool.AcquireSharedMt (); uint8_t * buf = msg->GetPayload (); htobe32buf (buf, len); memcpy (buf + 4, payload, len); diff --git a/libi2pd_client/I2CP.h b/libi2pd_client/I2CP.h index 5495be7a..3c5773ad 100644 --- a/libi2pd_client/I2CP.h +++ b/libi2pd_client/I2CP.h @@ -122,6 +122,7 @@ namespace client uint64_t m_LeaseSetExpirationTime; bool m_IsCreatingLeaseSet; boost::asio::deadline_timer m_LeaseSetCreationTimer; + i2p::util::MemoryPoolMt > m_I2NPMsgsPool; }; class RunnableI2CPDestination: private i2p::util::RunnableService, public I2CPDestination