Browse Source

Merge pull request #400 from majestrate/webui-add-tunnel-count

Add Transit/Client Tunnel Count to web ui
pull/401/head
orignal 9 years ago
parent
commit
5d41fe4a35
  1. 7
      HTTPServer.cpp
  2. 15
      Tunnel.cpp
  3. 5
      Tunnel.h

7
HTTPServer.cpp

@ -447,6 +447,13 @@ namespace util
s << "<br>\r\n<b>Routers:</b> " << i2p::data::netdb.GetNumRouters () << " "; s << "<br>\r\n<b>Routers:</b> " << i2p::data::netdb.GetNumRouters () << " ";
s << "<b>Floodfills:</b> " << i2p::data::netdb.GetNumFloodfills () << " "; s << "<b>Floodfills:</b> " << i2p::data::netdb.GetNumFloodfills () << " ";
s << "<b>LeaseSets:</b> " << i2p::data::netdb.GetNumLeaseSets () << "<br>\r\n"; s << "<b>LeaseSets:</b> " << i2p::data::netdb.GetNumLeaseSets () << "<br>\r\n";
size_t clientTunnelCount = i2p::tunnel::tunnels.CountOutboundTunnels();
clientTunnelCount += i2p::tunnel::tunnels.CountInboundTunnels();
size_t transitTunnelCount = i2p::tunnel::tunnels.CountTransitTunnels();
s << "<b>Client Tunnels:</b> " << std::to_string(clientTunnelCount) << " ";
s << "<b>Transit Tunnels:</b> " << std::to_string(transitTunnelCount) << "<br>\r\n";
} }
void HTTPConnection::HandleCommand (const std::string& command, std::stringstream& s) void HTTPConnection::HandleCommand (const std::string& command, std::stringstream& s)

15
Tunnel.cpp

@ -792,6 +792,21 @@ namespace tunnel
} }
return timeout; return timeout;
} }
size_t Tunnels::CountTransitTunnels() {
// TODO: locking
return m_TransitTunnels.size();
}
size_t Tunnels::CountInboundTunnels() {
// TODO: locking
return m_InboundTunnels.size();
}
size_t Tunnels::CountOutboundTunnels() {
// TODO: locking
return m_OutboundTunnels.size();
}
} }
} }

5
Tunnel.h

@ -202,6 +202,11 @@ namespace tunnel
const decltype(m_OutboundTunnels)& GetOutboundTunnels () const { return m_OutboundTunnels; }; const decltype(m_OutboundTunnels)& GetOutboundTunnels () const { return m_OutboundTunnels; };
const decltype(m_InboundTunnels)& GetInboundTunnels () const { return m_InboundTunnels; }; const decltype(m_InboundTunnels)& GetInboundTunnels () const { return m_InboundTunnels; };
const decltype(m_TransitTunnels)& GetTransitTunnels () const { return m_TransitTunnels; }; const decltype(m_TransitTunnels)& GetTransitTunnels () const { return m_TransitTunnels; };
size_t CountTransitTunnels();
size_t CountInboundTunnels();
size_t CountOutboundTunnels();
int GetQueueSize () { return m_Queue.GetSize (); }; int GetQueueSize () { return m_Queue.GetSize (); };
int GetTunnelCreationSuccessRate () const // in percents int GetTunnelCreationSuccessRate () const // in percents
{ {

Loading…
Cancel
Save