Browse Source

added some statistics

pull/102/head
orignal 10 years ago
parent
commit
96e8cab8fb
  1. 1
      Destination.h
  2. 7
      HTTPServer.cpp
  3. 8
      Streaming.cpp
  4. 6
      Streaming.h

1
Destination.h

@ -86,6 +86,7 @@ namespace stream @@ -86,6 +86,7 @@ namespace stream
public:
// for HTTP only
int GetNumRemoteLeaseSets () const { return m_RemoteLeaseSets.size (); };
const decltype(m_Streams)& GetStreams () const { return m_Streams; };
};

7
HTTPServer.cpp

@ -795,6 +795,7 @@ namespace util @@ -795,6 +795,7 @@ namespace util
auto dest = i2p::stream::FindLocalDestination (ident);
if (dest)
{
s << "<b>LeaseSets:</b> <i>" << dest->GetNumRemoteLeaseSets () << "</i><br>";
auto pool = dest->GetTunnelPool ();
if (pool)
{
@ -812,7 +813,11 @@ namespace util @@ -812,7 +813,11 @@ namespace util
}
s << "<br><b>Streams:</b><br>";
for (auto it: dest->GetStreams ())
s << it.first << "->" << it.second->GetRemoteIdentity ().GetIdentHash ().ToBase32 () << ".b32.i2p<br>" << std::endl;
{
s << it.first << "->" << it.second->GetRemoteIdentity ().GetIdentHash ().ToBase32 () << ".b32.i2p ";
s << " [" << it.second->GetNumSentBytes () << ":" << it.second->GetNumReceivedBytes () << "]";
s << "<br>"<< std::endl;
}
}
}

8
Streaming.cpp

@ -15,7 +15,8 @@ namespace stream @@ -15,7 +15,8 @@ namespace stream
m_SequenceNumber (0), m_LastReceivedSequenceNumber (-1), m_IsOpen (false),
m_IsReset (false), m_IsAckSendScheduled (false), m_LocalDestination (local),
m_RemoteLeaseSet (&remote), m_RoutingSession (nullptr), m_ReceiveTimer (m_Service),
m_ResendTimer (m_Service), m_AckSendTimer (m_Service)
m_ResendTimer (m_Service), m_AckSendTimer (m_Service), m_NumSentBytes (0),
m_NumReceivedBytes (0)
{
m_RecvStreamID = i2p::context.GetRandomNumberGenerator ().GenerateWord32 ();
UpdateCurrentRemoteLease ();
@ -25,7 +26,8 @@ namespace stream @@ -25,7 +26,8 @@ namespace stream
m_Service (service), m_SendStreamID (0), m_SequenceNumber (0), m_LastReceivedSequenceNumber (-1),
m_IsOpen (false), m_IsReset (false), m_IsAckSendScheduled (false), m_LocalDestination (local),
m_RemoteLeaseSet (nullptr), m_RoutingSession (nullptr), m_ReceiveTimer (m_Service),
m_ResendTimer (m_Service), m_AckSendTimer (m_Service)
m_ResendTimer (m_Service), m_AckSendTimer (m_Service), m_NumSentBytes (0),
m_NumReceivedBytes (0)
{
m_RecvStreamID = i2p::context.GetRandomNumberGenerator ().GenerateWord32 ();
}
@ -55,6 +57,7 @@ namespace stream @@ -55,6 +57,7 @@ namespace stream
void Stream::HandleNextPacket (Packet * packet)
{
m_NumReceivedBytes += packet->GetLength ();
if (!m_SendStreamID)
m_SendStreamID = packet->GetReceiveStreamID ();
@ -442,6 +445,7 @@ namespace stream @@ -442,6 +445,7 @@ namespace stream
m_CurrentRemoteLease.tunnelGateway, m_CurrentRemoteLease.tunnelID,
msg
});
m_NumSentBytes += it->GetLength ();
}
m_LocalDestination.SendTunnelDataMsgs (msgs);
}

6
Streaming.h

@ -97,7 +97,10 @@ namespace stream @@ -97,7 +97,10 @@ namespace stream
void AsyncReceive (const Buffer& buffer, ReceiveHandler handler, int timeout = 0);
void Close ();
size_t GetNumSentBytes () const { return m_NumSentBytes; };
size_t GetNumReceivedBytes () const { return m_NumReceivedBytes; };
private:
void SendQuickAck ();
@ -133,6 +136,7 @@ namespace stream @@ -133,6 +136,7 @@ namespace stream
std::set<Packet *, PacketCmp> m_SavedPackets;
std::set<Packet *, PacketCmp> m_SentPackets;
boost::asio::deadline_timer m_ReceiveTimer, m_ResendTimer, m_AckSendTimer;
size_t m_NumSentBytes, m_NumReceivedBytes;
};
//-------------------------------------------------

Loading…
Cancel
Save