mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
separate thread per local destination
This commit is contained in:
parent
82814dcc26
commit
c5c930bb72
2 changed files with 60 additions and 42 deletions
|
@ -18,11 +18,14 @@ namespace stream
|
|||
{
|
||||
public:
|
||||
|
||||
StreamingDestination (boost::asio::io_service& service, bool isPublic);
|
||||
StreamingDestination (boost::asio::io_service& service, const std::string& fullPath, bool isPublic);
|
||||
StreamingDestination (boost::asio::io_service& service, const i2p::data::PrivateKeys& keys, bool isPublic);
|
||||
StreamingDestination (bool isPublic);
|
||||
StreamingDestination (const std::string& fullPath, bool isPublic);
|
||||
StreamingDestination (const i2p::data::PrivateKeys& keys, bool isPublic);
|
||||
~StreamingDestination ();
|
||||
|
||||
void Start ();
|
||||
void Stop ();
|
||||
|
||||
i2p::tunnel::TunnelPool * GetTunnelPool () const { return m_Pool; };
|
||||
|
||||
Stream * CreateNewOutgoingStream (const i2p::data::LeaseSet& remote);
|
||||
|
@ -52,12 +55,17 @@ namespace stream
|
|||
|
||||
private:
|
||||
|
||||
void Run ();
|
||||
Stream * CreateNewIncomingStream ();
|
||||
void UpdateLeaseSet ();
|
||||
|
||||
private:
|
||||
|
||||
boost::asio::io_service& m_Service;
|
||||
bool m_IsRunning;
|
||||
std::thread * m_Thread;
|
||||
boost::asio::io_service m_Service;
|
||||
boost::asio::io_service::work m_Work;
|
||||
|
||||
std::mutex m_StreamsMutex;
|
||||
std::map<uint32_t, Stream *> m_Streams;
|
||||
i2p::data::PrivateKeys m_Keys;
|
||||
|
@ -75,8 +83,7 @@ namespace stream
|
|||
{
|
||||
public:
|
||||
|
||||
StreamingDestinations (): m_IsRunning (false), m_Thread (nullptr),
|
||||
m_Work (m_Service), m_SharedLocalDestination (nullptr) {};
|
||||
StreamingDestinations (): m_SharedLocalDestination (nullptr) {};
|
||||
~StreamingDestinations () {};
|
||||
|
||||
void Start ();
|
||||
|
@ -93,16 +100,10 @@ namespace stream
|
|||
|
||||
private:
|
||||
|
||||
void Run ();
|
||||
void LoadLocalDestinations ();
|
||||
|
||||
private:
|
||||
|
||||
bool m_IsRunning;
|
||||
std::thread * m_Thread;
|
||||
boost::asio::io_service m_Service;
|
||||
boost::asio::io_service::work m_Work;
|
||||
|
||||
std::mutex m_DestinationsMutex;
|
||||
std::map<i2p::data::IdentHash, StreamingDestination *> m_Destinations;
|
||||
StreamingDestination * m_SharedLocalDestination;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue