add lease set page in http server

This commit is contained in:
Jeff Becker 2016-07-15 09:38:21 -04:00
parent 4fdd9feddc
commit 71cc4b5bf2
No known key found for this signature in database
GPG key ID: AB950234D6EA286B
4 changed files with 76 additions and 3 deletions

11
NetDb.h
View file

@ -32,7 +32,10 @@ namespace data
const int NETDB_MIN_EXPIRATION_TIMEOUT = 90*60; // 1.5 hours
const int NETDB_MAX_EXPIRATION_TIMEOUT = 27*60*60; // 27 hours
const int NETDB_PUBLISH_INTERVAL = 60*40;
/** function for visiting a leaseset stored in a floodfill */
typedef std::function<void(const IdentHash, std::shared_ptr<LeaseSet>)> LeaseSetVisitor;
class NetDb
{
public:
@ -80,7 +83,10 @@ namespace data
int GetNumRouters () const { return m_RouterInfos.size (); };
int GetNumFloodfills () const { return m_Floodfills.size (); };
int GetNumLeaseSets () const { return m_LeaseSets.size (); };
/** visit all lease sets we currently store */
void VisitLeaseSets(LeaseSetVisitor v);
private:
void Load ();
@ -98,6 +104,7 @@ namespace data
private:
mutable std::mutex m_LeaseSetsMutex;
std::map<IdentHash, std::shared_ptr<LeaseSet> > m_LeaseSets;
mutable std::mutex m_RouterInfosMutex;
std::map<IdentHash, std::shared_ptr<RouterInfo> > m_RouterInfos;