mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-27 11:17:49 +02:00
add NetDb::WaitForReady
This commit is contained in:
parent
fec49e5609
commit
10ffdb2766
2 changed files with 17 additions and 5 deletions
8
NetDb.h
8
NetDb.h
|
@ -8,6 +8,7 @@
|
|||
#include <string>
|
||||
#include <thread>
|
||||
#include <mutex>
|
||||
#include <future>
|
||||
|
||||
#include "Base.h"
|
||||
#include "Gzip.h"
|
||||
|
@ -48,7 +49,9 @@ namespace data
|
|||
|
||||
void Start ();
|
||||
void Stop ();
|
||||
|
||||
/** block until netdb is ready, call only once*/
|
||||
void WaitForReady();
|
||||
|
||||
bool AddRouterInfo (const uint8_t * buf, int len);
|
||||
bool AddRouterInfo (const IdentHash& ident, const uint8_t * buf, int len);
|
||||
bool AddLeaseSet (const IdentHash& ident, const uint8_t * buf, int len, std::shared_ptr<i2p::tunnel::InboundTunnel> from);
|
||||
|
@ -109,7 +112,8 @@ namespace data
|
|||
std::shared_ptr<const RouterInfo> GetRandomRouter (Filter filter) const;
|
||||
|
||||
private:
|
||||
|
||||
std::promise<void> * m_Ready;
|
||||
|
||||
mutable std::mutex m_LeaseSetsMutex;
|
||||
std::map<IdentHash, std::shared_ptr<LeaseSet> > m_LeaseSets;
|
||||
mutable std::mutex m_RouterInfosMutex;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue