mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-27 19:27:49 +02:00
add threadpool for ntcp dh
This commit is contained in:
parent
b02464990b
commit
91fdb038d9
3 changed files with 98 additions and 17 deletions
|
@ -12,6 +12,7 @@
|
|||
#include "RouterInfo.h"
|
||||
#include "I2NPProtocol.h"
|
||||
#include "TransportSession.h"
|
||||
#include "CryptoWorker.h"
|
||||
|
||||
namespace i2p
|
||||
{
|
||||
|
@ -131,6 +132,8 @@ namespace transport
|
|||
{
|
||||
public:
|
||||
|
||||
typedef i2p::worker::ThreadPool<NTCPSession> Pool;
|
||||
|
||||
enum RemoteAddressType
|
||||
{
|
||||
eIP4Address,
|
||||
|
@ -146,7 +149,7 @@ namespace transport
|
|||
};
|
||||
|
||||
|
||||
NTCPServer ();
|
||||
NTCPServer (int workers=4);
|
||||
~NTCPServer ();
|
||||
|
||||
void Start ();
|
||||
|
@ -193,6 +196,11 @@ namespace transport
|
|||
void ScheduleTermination ();
|
||||
void HandleTerminationTimer (const boost::system::error_code& ecode);
|
||||
|
||||
void Work(std::shared_ptr<NTCPSession> conn, Pool::WorkFunc work)
|
||||
{
|
||||
m_CryptoPool->Offer({conn, work});
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
bool m_IsRunning;
|
||||
|
@ -210,6 +218,8 @@ namespace transport
|
|||
boost::asio::ip::tcp::resolver m_Resolver;
|
||||
boost::asio::ip::tcp::endpoint * m_ProxyEndpoint;
|
||||
|
||||
std::shared_ptr<Pool> m_CryptoPool;
|
||||
|
||||
uint16_t m_SoftLimit, m_HardLimit;
|
||||
public:
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue