From 708e17162c5c53554fa1a8e34bbe4c2c149962e2 Mon Sep 17 00:00:00 2001 From: orignal Date: Tue, 17 Mar 2015 15:36:15 -0400 Subject: [PATCH] handle i2p.router.net.bw requests --- I2PControl.cpp | 12 ++++++++++++ I2PControl.h | 8 ++++++-- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/I2PControl.cpp b/I2PControl.cpp index 4954f804..971c6b9f 100644 --- a/I2PControl.cpp +++ b/I2PControl.cpp @@ -40,6 +40,8 @@ namespace client 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; + m_RouterInfoHandlers[I2P_CONTROL_ROUTER_INFO_BW_IB_1S] = &I2PControlService::InboundBandwidth1S ; + m_RouterInfoHandlers[I2P_CONTROL_ROUTER_INFO_BW_OB_1S] = &I2PControlService::OutboundBandwidth1S ; // RouterManager m_RouterManagerHandlers[I2P_CONTROL_ROUTER_MANAGER_SHUTDOWN] = &I2PControlService::ShutdownHandler; @@ -332,6 +334,16 @@ namespace client results[I2P_CONTROL_ROUTER_INFO_TUNNELS_PARTICIPATING] = boost::lexical_cast(i2p::tunnel::tunnels.GetTransitTunnels ().size ()); } + void I2PControlService::InboundBandwidth1S (std::map& results) + { + results[I2P_CONTROL_ROUTER_INFO_BW_IB_1S] = boost::lexical_cast(i2p::transport::transports.GetInBandwidth ()); + } + + void I2PControlService::OutboundBandwidth1S (std::map& results) + { + results[I2P_CONTROL_ROUTER_INFO_BW_OB_1S] = boost::lexical_cast(i2p::transport::transports.GetOutBandwidth ()); + } + // RouterManager void I2PControlService::RouterManagerHandler (const std::map& params, std::map& results) diff --git a/I2PControl.h b/I2PControl.h index f7e76949..11ab3dc3 100644 --- a/I2PControl.h +++ b/I2PControl.h @@ -49,8 +49,10 @@ namespace client 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"; - + const char I2P_CONTROL_ROUTER_INFO_TUNNELS_PARTICIPATING[] = "i2p.router.net.tunnels.participating"; + const char I2P_CONTROL_ROUTER_INFO_BW_IB_1S[] = "i2p.router.net.bw.inbound.1s"; + const char I2P_CONTROL_ROUTER_INFO_BW_OB_1S[] = "i2p.router.net.bw.outbound.1s"; + // RouterManager requests const char I2P_CONTROL_ROUTER_MANAGER_SHUTDOWN[] = "Shutdown"; const char I2P_CONTROL_ROUTER_MANAGER_SHUTDOWN_GRACEFUL[] = "ShutdownGraceful"; @@ -102,6 +104,8 @@ namespace client void NetDbActivePeersHandler (std::map& results); void StatusHandler (std::map& results); void TunnelsParticipatingHandler (std::map& results); + void InboundBandwidth1S (std::map& results); + void OutboundBandwidth1S (std::map& results); // RouterManager typedef void (I2PControlService::*RouterManagerRequestHandler)(std::map& results);