mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-04-28 11:47:48 +02:00
Exploratory
This commit is contained in:
parent
1377aa2706
commit
63e3a21291
4 changed files with 163 additions and 33 deletions
16
NetDb.h
16
NetDb.h
|
@ -4,6 +4,7 @@
|
|||
#include <inttypes.h>
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <thread>
|
||||
#include "RouterInfo.h"
|
||||
#include "LeaseSet.h"
|
||||
|
||||
|
@ -17,23 +18,34 @@ namespace data
|
|||
|
||||
NetDb ();
|
||||
~NetDb ();
|
||||
|
||||
void Start ();
|
||||
void Stop ();
|
||||
|
||||
void AddRouterInfo (uint8_t * buf, int len);
|
||||
void AddLeaseSet (uint8_t * buf, int len);
|
||||
RouterInfo * FindRouter (const uint8_t * ident);
|
||||
|
||||
void RequestDestination (const uint8_t * destination, const uint8_t * router);
|
||||
void HandleDatabaseSearchReply (const uint8_t * key, const uint8_t * router);
|
||||
|
||||
const RouterInfo * GetNextFloodfill () const;
|
||||
const RouterInfo * GetRandomNTCPRouter (bool floodfillOnly = false) const;
|
||||
const RouterInfo * GetRandomRouter () const;
|
||||
|
||||
private:
|
||||
|
||||
void Load (const char * directory);
|
||||
|
||||
void Run (); // exploratory thread
|
||||
void Explore ();
|
||||
|
||||
private:
|
||||
|
||||
std::map<std::string, LeaseSet *> m_LeaseSets;
|
||||
std::map<std::string, RouterInfo *> m_RouterInfos;
|
||||
|
||||
bool m_IsRunning;
|
||||
std::thread * m_Thread;
|
||||
uint8_t m_Exploratory[32];
|
||||
};
|
||||
|
||||
extern NetDb netdb;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue