mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
reuse NTCP2 frame buffers
This commit is contained in:
parent
2b61f9a731
commit
f7728aa1f6
2 changed files with 19 additions and 6 deletions
|
@ -6,8 +6,10 @@
|
|||
#include <thread>
|
||||
#include <list>
|
||||
#include <map>
|
||||
#include <array>
|
||||
#include <openssl/bn.h>
|
||||
#include <boost/asio.hpp>
|
||||
#include "util.h"
|
||||
#include "RouterInfo.h"
|
||||
#include "TransportSession.h"
|
||||
|
||||
|
@ -57,6 +59,7 @@ namespace transport
|
|||
};
|
||||
|
||||
|
||||
typedef std::array<uint8_t, NTCP2_UNENCRYPTED_FRAME_MAX_SIZE> NTCP2FrameBuffer;
|
||||
struct NTCP2Establisher
|
||||
{
|
||||
NTCP2Establisher ();
|
||||
|
@ -187,6 +190,9 @@ namespace transport
|
|||
|
||||
void Connect(const boost::asio::ip::address & address, uint16_t port, std::shared_ptr<NTCP2Session> conn);
|
||||
|
||||
NTCP2FrameBuffer * NewNTCP2FrameBuffer () { return m_NTCP2FrameBuffersPool.Acquire(); }
|
||||
void DeleteNTCP2FrameBuffer (NTCP2FrameBuffer * buf) { return m_NTCP2FrameBuffersPool.Release(buf); }
|
||||
|
||||
private:
|
||||
|
||||
void Run ();
|
||||
|
@ -210,6 +216,8 @@ namespace transport
|
|||
std::map<i2p::data::IdentHash, std::shared_ptr<NTCP2Session> > m_NTCP2Sessions;
|
||||
std::list<std::shared_ptr<NTCP2Session> > m_PendingIncomingSessions;
|
||||
|
||||
i2p::util::MemoryPool<NTCP2FrameBuffer> m_NTCP2FrameBuffersPool;
|
||||
|
||||
public:
|
||||
|
||||
// for HTTP/I2PControl
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue