Browse Source

show tunnels queue size

pull/157/head
orignal 10 years ago
parent
commit
14f448f4c7
  1. 2
      HTTPServer.cpp
  2. 6
      Queue.h
  3. 1
      Tunnel.h

2
HTTPServer.cpp

@ -751,6 +751,8 @@ namespace util
void HTTPConnection::ShowTunnels (std::stringstream& s) void HTTPConnection::ShowTunnels (std::stringstream& s)
{ {
s << "Queue size:" << i2p::tunnel::tunnels.GetQueueSize () << "<br>";
for (auto it: i2p::tunnel::tunnels.GetOutboundTunnels ()) for (auto it: i2p::tunnel::tunnels.GetOutboundTunnels ())
{ {
it->GetTunnelConfig ()->Print (s); it->GetTunnelConfig ()->Print (s);

6
Queue.h

@ -77,6 +77,12 @@ namespace util
return m_Queue.empty (); return m_Queue.empty ();
} }
int GetSize ()
{
std::unique_lock<std::mutex> l(m_QueueMutex);
return m_Queue.size ();
}
void WakeUp () { m_NonEmpty.notify_all (); }; void WakeUp () { m_NonEmpty.notify_all (); };
Element * Get () Element * Get ()

1
Tunnel.h

@ -181,6 +181,7 @@ 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; };
int GetQueueSize () { return m_Queue.GetSize (); };
}; };
extern Tunnels tunnels; extern Tunnels tunnels;

Loading…
Cancel
Save