Browse Source

I2NP messages pool for I2CP

pull/1727/head
orignal 3 years ago
parent
commit
40e6d675c5
  1. 2
      libi2pd_client/I2CP.cpp
  2. 1
      libi2pd_client/I2CP.h

2
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) 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 (); uint8_t * buf = msg->GetPayload ();
htobe32buf (buf, len); htobe32buf (buf, len);
memcpy (buf + 4, payload, len); memcpy (buf + 4, payload, len);

1
libi2pd_client/I2CP.h

@ -122,6 +122,7 @@ namespace client
uint64_t m_LeaseSetExpirationTime; uint64_t m_LeaseSetExpirationTime;
bool m_IsCreatingLeaseSet; bool m_IsCreatingLeaseSet;
boost::asio::deadline_timer m_LeaseSetCreationTimer; boost::asio::deadline_timer m_LeaseSetCreationTimer;
i2p::util::MemoryPoolMt<I2NPMessageBuffer<I2NP_MAX_MESSAGE_SIZE> > m_I2NPMsgsPool;
}; };
class RunnableI2CPDestination: private i2p::util::RunnableService, public I2CPDestination class RunnableI2CPDestination: private i2p::util::RunnableService, public I2CPDestination

Loading…
Cancel
Save