|
|
|
@ -1,10 +1,12 @@
|
|
|
|
|
#include <fstream>
|
|
|
|
|
#include <cryptopp/dh.h>
|
|
|
|
|
#include <cryptopp/dsa.h>
|
|
|
|
|
#include <boost/lexical_cast.hpp>
|
|
|
|
|
#include "CryptoConst.h"
|
|
|
|
|
#include "RouterContext.h"
|
|
|
|
|
#include "Timestamp.h"
|
|
|
|
|
#include "I2NPProtocol.h"
|
|
|
|
|
#include "NetDb.h"
|
|
|
|
|
#include "util.h"
|
|
|
|
|
#include "version.h"
|
|
|
|
|
|
|
|
|
@ -54,6 +56,12 @@ 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 ();
|
|
|
|
@ -115,7 +123,12 @@ namespace i2p
|
|
|
|
|
if (floodfill)
|
|
|
|
|
m_RouterInfo.SetCaps (m_RouterInfo.GetCaps () | i2p::data::RouterInfo::eFloodfill);
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
m_RouterInfo.SetCaps (m_RouterInfo.GetCaps () & ~i2p::data::RouterInfo::eFloodfill);
|
|
|
|
|
// we don't publish number of routers and leaseset for non-floodfill
|
|
|
|
|
m_RouterInfo.DeleteProperty (ROUTER_INFO_PROPERTY_LEASESETS);
|
|
|
|
|
m_RouterInfo.DeleteProperty (ROUTER_INFO_PROPERTY_ROUTERS);
|
|
|
|
|
}
|
|
|
|
|
UpdateRouterInfo ();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|