initial wack at single threaded sam

This commit is contained in:
Jeff Becker 2019-07-12 11:49:21 -04:00
parent a090114066
commit 0098f5b98c
No known key found for this signature in database
GPG key ID: F357B3B42F6F9B05
6 changed files with 74 additions and 34 deletions

View file

@ -95,7 +95,9 @@ namespace client
public:
LeaseSetDestination (bool isPublic, const std::map<std::string, std::string> * params = nullptr);
LeaseSetDestination (std::shared_ptr<boost::asio::io_service> service, bool isPublic, const std::map<std::string, std::string> * params = nullptr);
LeaseSetDestination (bool isPublic, const std::map<std::string, std::string> * params = nullptr) :
LeaseSetDestination(std::make_shared<boost::asio::io_service>(), isPublic, params) {};
~LeaseSetDestination ();
const std::string& GetNickname () const { return m_Nickname; };
@ -106,7 +108,7 @@ namespace client
virtual bool Reconfigure(std::map<std::string, std::string> i2cpOpts);
bool IsRunning () const { return m_IsRunning; };
boost::asio::io_service& GetService () { return m_Service; };
boost::asio::io_service& GetService () { return *m_Service; };
std::shared_ptr<i2p::tunnel::TunnelPool> GetTunnelPool () { return m_Pool; };
bool IsReady () const { return m_LeaseSet && !m_LeaseSet->IsExpired () && m_Pool->GetOutboundTunnels ().size () > 0; };
std::shared_ptr<i2p::data::LeaseSet> FindLeaseSet (const i2p::data::IdentHash& ident);
@ -159,7 +161,7 @@ namespace client
volatile bool m_IsRunning;
std::thread * m_Thread;
boost::asio::io_service m_Service;
std::shared_ptr<boost::asio::io_service> m_Service;
mutable std::mutex m_RemoteLeaseSetsMutex;
std::map<i2p::data::IdentHash, std::shared_ptr<i2p::data::LeaseSet> > m_RemoteLeaseSets;
std::map<i2p::data::IdentHash, std::shared_ptr<LeaseSetRequest> > m_LeaseSetRequests;
@ -196,8 +198,9 @@ namespace client
// if cancelled before ready, informs promise with nullptr
void Ready(ReadyPromise & p);
#endif
ClientDestination (const i2p::data::PrivateKeys& keys, bool isPublic, const std::map<std::string, std::string> * params = nullptr);
ClientDestination (const i2p::data::PrivateKeys& keys, bool isPublic, const std::map<std::string, std::string> * params = nullptr) :
ClientDestination(std::make_shared<boost::asio::io_service>(), keys, isPublic, params) {};
ClientDestination (std::shared_ptr<boost::asio::io_service> service, const i2p::data::PrivateKeys& keys, bool isPublic, const std::map<std::string, std::string> * params = nullptr);
~ClientDestination ();
virtual bool Start ();