Browse Source

UpdateStats for RouterContext

pull/165/head
orignal 10 years ago
parent
commit
1caacaacf0
  1. 1
      NetDb.cpp
  2. 17
      RouterContext.cpp
  3. 3
      RouterContext.h

1
NetDb.cpp

@ -861,6 +861,7 @@ namespace data @@ -861,6 +861,7 @@ namespace data
void NetDb::Publish ()
{
i2p::context.UpdateStats ();
std::set<IdentHash> excluded; // TODO: fill up later
for (int i = 0; i < 2; i++)
{

17
RouterContext.cpp

@ -56,12 +56,6 @@ namespace i2p @@ -56,12 +56,6 @@ namespace i2p
void RouterContext::UpdateRouterInfo ()
{
if (m_IsFloodfill)
{
// update routers and leasesets
m_RouterInfo.SetProperty (ROUTER_INFO_PROPERTY_LEASESETS, boost::lexical_cast<std::string>(i2p::data::netdb.GetNumLeaseSets ()));
m_RouterInfo.SetProperty (ROUTER_INFO_PROPERTY_ROUTERS, boost::lexical_cast<std::string>(i2p::data::netdb.GetNumRouters ()));
}
m_RouterInfo.CreateBuffer (m_Keys);
m_RouterInfo.SaveToFile (i2p::util::filesystem::GetFullPath (ROUTER_INFO));
m_LastUpdateTime = i2p::util::GetSecondsSinceEpoch ();
@ -233,6 +227,17 @@ namespace i2p @@ -233,6 +227,17 @@ namespace i2p
if (updated)
UpdateRouterInfo ();
}
void RouterContext::UpdateStats ()
{
if (m_IsFloodfill)
{
// update routers and leasesets
m_RouterInfo.SetProperty (ROUTER_INFO_PROPERTY_LEASESETS, boost::lexical_cast<std::string>(i2p::data::netdb.GetNumLeaseSets ()));
m_RouterInfo.SetProperty (ROUTER_INFO_PROPERTY_ROUTERS, boost::lexical_cast<std::string>(i2p::data::netdb.GetNumRouters ()));
UpdateRouterInfo ();
}
}
bool RouterContext::Load ()
{

3
RouterContext.h

@ -60,7 +60,8 @@ namespace i2p @@ -60,7 +60,8 @@ namespace i2p
void SetAcceptsTunnels (bool acceptsTunnels) { m_AcceptsTunnels = acceptsTunnels; };
bool SupportsV6 () const { return m_RouterInfo.IsV6 (); };
void SetSupportsV6 (bool supportsV6);
void UpdateNTCPV6Address (const boost::asio::ip::address& host); // called from NTCP session
void UpdateNTCPV6Address (const boost::asio::ip::address& host); // called from NTCP session
void UpdateStats ();
// implements LocalDestination
const i2p::data::PrivateKeys& GetPrivateKeys () const { return m_Keys; };

Loading…
Cancel
Save