mirror of
https://github.com/PurpleI2P/i2pd.git
synced 2025-01-22 04:04:16 +00:00
handle i2p.router.netdb.knownpeers RouterInfo request
This commit is contained in:
parent
047f08b482
commit
70b6c024bf
@ -3,6 +3,7 @@
|
|||||||
#include <boost/property_tree/ptree.hpp>
|
#include <boost/property_tree/ptree.hpp>
|
||||||
#include <boost/property_tree/json_parser.hpp>
|
#include <boost/property_tree/json_parser.hpp>
|
||||||
#include "Log.h"
|
#include "Log.h"
|
||||||
|
#include "NetDb.h"
|
||||||
#include "Timestamp.h"
|
#include "Timestamp.h"
|
||||||
#include "I2PControl.h"
|
#include "I2PControl.h"
|
||||||
|
|
||||||
@ -117,6 +118,7 @@ namespace client
|
|||||||
std::map<std::string, std::string> params;
|
std::map<std::string, std::string> params;
|
||||||
for (auto& v: pt.get_child (I2P_CONTROL_PROPERTY_PARAMS))
|
for (auto& v: pt.get_child (I2P_CONTROL_PROPERTY_PARAMS))
|
||||||
{
|
{
|
||||||
|
LogPrint (eLogInfo, v.first);
|
||||||
if (!v.first.empty())
|
if (!v.first.empty())
|
||||||
params[v.first] = v.second.data ();
|
params[v.first] = v.second.data ();
|
||||||
}
|
}
|
||||||
@ -189,6 +191,13 @@ namespace client
|
|||||||
|
|
||||||
void I2PControlService::RouterInfoHandler (const std::map<std::string, std::string>& params, std::map<std::string, std::string>& results)
|
void I2PControlService::RouterInfoHandler (const std::map<std::string, std::string>& params, std::map<std::string, std::string>& results)
|
||||||
{
|
{
|
||||||
|
LogPrint (eLogDebug, "I2PControl RouterInfo");
|
||||||
|
for (auto& it :params)
|
||||||
|
{
|
||||||
|
LogPrint (eLogDebug, it.first);
|
||||||
|
if (it.first == I2P_CONTROL_PARAM_RI_NETDB_KNOWNPEERS)
|
||||||
|
results[I2P_CONTROL_PARAM_RI_NETDB_KNOWNPEERS] = boost::lexical_cast<std::string>(i2p::data::netdb.GetNumRouters ());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -33,6 +33,10 @@ namespace client
|
|||||||
const char I2P_CONTROL_PARAM_ECHO[] = "Echo";
|
const char I2P_CONTROL_PARAM_ECHO[] = "Echo";
|
||||||
const char I2P_CONTROL_PARAM_RESULT[] = "Result";
|
const char I2P_CONTROL_PARAM_RESULT[] = "Result";
|
||||||
|
|
||||||
|
// RouterInfo params
|
||||||
|
const char I2P_CONTROL_PARAM_RI_NETDB_KNOWNPEERS[] = "i2p.router.netdb.knownpeers";
|
||||||
|
|
||||||
|
|
||||||
class I2PControlService
|
class I2PControlService
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user