show router status through I2PControl

This commit is contained in:
orignal 2015-03-05 15:17:16 -05:00
parent 9d273acd42
commit 42f314669f
2 changed files with 9 additions and 1 deletions

View File

@ -38,6 +38,7 @@ namespace client
m_RouterInfoHandlers[I2P_CONTROL_ROUTER_INFO_UPTIME] = &I2PControlService::UptimeHandler;
m_RouterInfoHandlers[I2P_CONTROL_ROUTER_INFO_NETDB_KNOWNPEERS] = &I2PControlService::NetDbKnownPeersHandler;
m_RouterInfoHandlers[I2P_CONTROL_ROUTER_INFO_NETDB_ACTIVEPEERS] = &I2PControlService::NetDbActivePeersHandler;
m_RouterInfoHandlers[I2P_CONTROL_ROUTER_INFO_STATUS] = &I2PControlService::StatusHandler;
m_RouterInfoHandlers[I2P_CONTROL_ROUTER_INFO_TUNNELS_PARTICIPATING] = &I2PControlService::TunnelsParticipatingHandler;
// RouterManager
@ -307,6 +308,11 @@ namespace client
results[I2P_CONTROL_ROUTER_INFO_NETDB_ACTIVEPEERS] = boost::lexical_cast<std::string>(i2p::transport::transports.GetPeers ().size ());
}
void I2PControlService::StatusHandler (std::map<std::string, std::string>& results)
{
results[I2P_CONTROL_ROUTER_INFO_STATUS] = boost::lexical_cast<std::string>((int)i2p::context.GetStatus ());
}
void I2PControlService::TunnelsParticipatingHandler (std::map<std::string, std::string>& results)
{
results[I2P_CONTROL_ROUTER_INFO_TUNNELS_PARTICIPATING] = boost::lexical_cast<std::string>(i2p::tunnel::tunnels.GetTransitTunnels ().size ());

View File

@ -47,6 +47,7 @@ namespace client
const char I2P_CONTROL_ROUTER_INFO_UPTIME[] = "i2p.router.uptime";
const char I2P_CONTROL_ROUTER_INFO_NETDB_KNOWNPEERS[] = "i2p.router.netdb.knownpeers";
const char I2P_CONTROL_ROUTER_INFO_NETDB_ACTIVEPEERS[] = "i2p.router.netdb.activepeers";
const char I2P_CONTROL_ROUTER_INFO_STATUS[] = "i2p.router.net.status";
const char I2P_CONTROL_ROUTER_INFO_TUNNELS_PARTICIPATING[] = "i2p.router.net.tunnels.participating";
// RouterManager requests
@ -97,7 +98,8 @@ namespace client
typedef void (I2PControlService::*RouterInfoRequestHandler)(std::map<std::string, std::string>& results);
void UptimeHandler (std::map<std::string, std::string>& results);
void NetDbKnownPeersHandler (std::map<std::string, std::string>& results);
void NetDbActivePeersHandler (std::map<std::string, std::string>& results);
void NetDbActivePeersHandler (std::map<std::string, std::string>& results);
void StatusHandler (std::map<std::string, std::string>& results);
void TunnelsParticipatingHandler (std::map<std::string, std::string>& results);
// RouterManager