Skip to content

Commit

Permalink
show tunnels queue size
Browse files Browse the repository at this point in the history
  • Loading branch information
orignal committed Feb 3, 2015
1 parent cd8e9e5 commit 14f448f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 1 deletion.
2 changes: 2 additions & 0 deletions HTTPServer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -751,6 +751,8 @@ namespace util

void HTTPConnection::ShowTunnels (std::stringstream& s)
{
s << "Queue size:" << i2p::tunnel::tunnels.GetQueueSize () << "<br>";

for (auto it: i2p::tunnel::tunnels.GetOutboundTunnels ())
{
it->GetTunnelConfig ()->Print (s);
Expand Down
8 changes: 7 additions & 1 deletion Queue.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,13 @@ namespace util
std::unique_lock<std::mutex> l(m_QueueMutex);
return m_Queue.empty ();
}


int GetSize ()
{
std::unique_lock<std::mutex> l(m_QueueMutex);
return m_Queue.size ();
}

void WakeUp () { m_NonEmpty.notify_all (); };

Element * Get ()
Expand Down
1 change: 1 addition & 0 deletions Tunnel.h
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,7 @@ namespace tunnel
const decltype(m_OutboundTunnels)& GetOutboundTunnels () const { return m_OutboundTunnels; };
const decltype(m_InboundTunnels)& GetInboundTunnels () const { return m_InboundTunnels; };
const decltype(m_TransitTunnels)& GetTransitTunnels () const { return m_TransitTunnels; };
int GetQueueSize () { return m_Queue.GetSize (); };
};

extern Tunnels tunnels;
Expand Down

0 comments on commit 14f448f

Please sign in to comment.