diff --git a/I2PControl.cpp b/I2PControl.cpp index aa36817f..fae0283e 100644 --- a/I2PControl.cpp +++ b/I2PControl.cpp @@ -10,6 +10,7 @@ #include "Daemon.h" #include "Tunnel.h" #include "Timestamp.h" +#include "Transports.h" namespace i2p { @@ -28,6 +29,7 @@ namespace client // RouterInfo 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_TUNNELS_PARTICIPATING] = &I2PControlService::TunnelsParticipatingHandler; // RouterManager @@ -226,9 +228,14 @@ namespace client results[I2P_CONTROL_ROUTER_INFO_NETDB_KNOWNPEERS] = boost::lexical_cast(i2p::data::netdb.GetNumRouters ()); } + void I2PControlService::NetDbActivePeersHandler (std::map& results) + { + results[I2P_CONTROL_ROUTER_INFO_NETDB_ACTIVEPEERS] = boost::lexical_cast(i2p::data::netdb.GetNumRouters ()); + } + void I2PControlService::TunnelsParticipatingHandler (std::map& results) { - results[I2P_CONTROL_ROUTER_INFO_TUNNELS_PARTICIPATING] = boost::lexical_cast(i2p::tunnel::tunnels.GetTransitTunnels ().size ()); + results[I2P_CONTROL_ROUTER_INFO_TUNNELS_PARTICIPATING] = boost::lexical_cast(i2p::transport::transports.GetPeers ().size ()); } // RouterManager diff --git a/I2PControl.h b/I2PControl.h index 2f51dab0..142742f5 100644 --- a/I2PControl.h +++ b/I2PControl.h @@ -37,6 +37,7 @@ namespace client // RouterInfo requests 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_TUNNELS_PARTICIPATING[] = "i2p.router.net.tunnels.participating"; // RouterManager requests @@ -80,7 +81,8 @@ namespace client // RouterInfo typedef void (I2PControlService::*RouterInfoRequestHandler)(std::map& results); - void NetDbKnownPeersHandler (std::map& results); + void NetDbKnownPeersHandler (std::map& results); + void NetDbActivePeersHandler (std::map& results); void TunnelsParticipatingHandler (std::map& results); // RouterManager diff --git a/Transports.h b/Transports.h index 2ea375e2..5aa225f2 100644 --- a/Transports.h +++ b/Transports.h @@ -114,6 +114,7 @@ namespace transport // for HTTP only const NTCPServer * GetNTCPServer () const { return m_NTCPServer; }; const SSUServer * GetSSUServer () const { return m_SSUServer; }; + const decltype(m_Peers)& GetPeers () const { return m_Peers; }; }; extern Transports transports;