diff --git a/HTTPServer.cpp b/HTTPServer.cpp
index 98ac5950..7057cb46 100644
--- a/HTTPServer.cpp
+++ b/HTTPServer.cpp
@@ -303,6 +303,7 @@ namespace util
s << it.second->GetRemoteRouterInfo ().GetIdentHashAbbreviation () << ": "
<< it.second->GetSocket ().remote_endpoint().address ().to_string ();
if (!outgoing) s << "-->";
+ s << " [" << it.second->GetNumSentBytes () << ":" << it.second->GetNumReceivedBytes () << "]";
s << "
";
}
}
@@ -318,6 +319,7 @@ namespace util
if (outgoing) s << "-->";
s << endpoint.address ().to_string () << ":" << endpoint.port ();
if (!outgoing) s << "-->";
+ s << " [" << it.second->GetNumSentBytes () << ":" << it.second->GetNumReceivedBytes () << "]";
s << "
";
}
}
diff --git a/NTCPSession.cpp b/NTCPSession.cpp
index 14b79c19..1d1f098a 100644
--- a/NTCPSession.cpp
+++ b/NTCPSession.cpp
@@ -21,15 +21,15 @@ namespace ntcp
{
NTCPSession::NTCPSession (boost::asio::io_service& service, i2p::data::RouterInfo& in_RemoteRouterInfo):
m_Socket (service), m_TerminationTimer (service), m_IsEstablished (false),
- m_RemoteRouterInfo (in_RemoteRouterInfo), m_ReceiveBufferOffset (0), m_NextMessage (nullptr)
+ m_RemoteRouterInfo (in_RemoteRouterInfo), m_ReceiveBufferOffset (0), m_NextMessage (nullptr),
+ m_NumSentBytes (0), m_NumReceivedBytes (0)
{
- m_DHKeysPair = i2p::transports.GetNextDHKeysPair ();
+ m_DHKeysPair = i2p::transports.GetNextDHKeysPair ();
}
NTCPSession::~NTCPSession ()
{
delete m_DHKeysPair;
- delete m_NextMessage;
}
void NTCPSession::CreateAESKey (uint8_t * pubKey, uint8_t * aesKey)
@@ -403,7 +403,7 @@ namespace ntcp
}
else
{
- LogPrint ("Received: ", bytes_transferred);
+ m_NumReceivedBytes += bytes_transferred;
m_ReceiveBufferOffset += bytes_transferred;
if (m_ReceiveBufferOffset >= 16)
@@ -514,7 +514,7 @@ namespace ntcp
}
else
{
- LogPrint ("Msg sent: ", bytes_transferred);
+ m_NumSentBytes += bytes_transferred;
ScheduleTermination (); // reset termination timer
}
}
diff --git a/NTCPSession.h b/NTCPSession.h
index 4b9e40ce..1d03708b 100644
--- a/NTCPSession.h
+++ b/NTCPSession.h
@@ -78,6 +78,9 @@ namespace ntcp
void ClientLogin ();
void ServerLogin ();
void SendI2NPMessage (I2NPMessage * msg);
+
+ size_t GetNumSentBytes () const { return m_NumSentBytes; };
+ size_t GetNumReceivedBytes () const { return m_NumReceivedBytes; };
protected:
@@ -142,6 +145,8 @@ namespace ntcp
i2p::I2NPMessage * m_NextMessage;
std::list m_DelayedMessages;
size_t m_NextMessageOffset;
+
+ size_t m_NumSentBytes, m_NumReceivedBytes;
};
class NTCPClient: public NTCPSession
diff --git a/SSU.cpp b/SSU.cpp
index 63528e96..05802f1f 100644
--- a/SSU.cpp
+++ b/SSU.cpp
@@ -19,7 +19,8 @@ namespace ssu
const i2p::data::RouterInfo * router, bool peerTest ):
m_Server (server), m_RemoteEndpoint (remoteEndpoint), m_RemoteRouter (router),
m_Timer (m_Server.GetService ()), m_PeerTest (peerTest), m_State (eSessionStateUnknown),
- m_IsSessionKey (false), m_RelayTag (0), m_Data (*this)
+ m_IsSessionKey (false), m_RelayTag (0), m_Data (*this),
+ m_NumSentBytes (0), m_NumReceivedBytes (0)
{
m_DHKeysPair = i2p::transports.GetNextDHKeysPair ();
}
@@ -74,6 +75,7 @@ namespace ssu
void SSUSession::ProcessNextMessage (uint8_t * buf, size_t len, const boost::asio::ip::udp::endpoint& senderEndpoint)
{
+ m_NumReceivedBytes += len;
if (m_State == eSessionStateIntroduced)
{
// HolePunch received
@@ -842,6 +844,7 @@ namespace ssu
void SSUSession::Send (const uint8_t * buf, size_t size)
{
+ m_NumSentBytes += size;
m_Server.Send (buf, size, m_RemoteEndpoint);
}
@@ -910,7 +913,6 @@ namespace ssu
void SSUServer::Send (const uint8_t * buf, size_t len, const boost::asio::ip::udp::endpoint& to)
{
m_Socket.send_to (boost::asio::buffer (buf, len), to);
- LogPrint ("SSU sent ", len, " bytes");
}
void SSUServer::Receive ()
@@ -923,7 +925,6 @@ namespace ssu
{
if (!ecode)
{
- LogPrint ("SSU received ", bytes_transferred, " bytes");
SSUSession * session = nullptr;
auto it = m_Sessions.find (m_SenderEndpoint);
if (it != m_Sessions.end ())
diff --git a/SSU.h b/SSU.h
index a64b555c..01870cd2 100644
--- a/SSU.h
+++ b/SSU.h
@@ -73,7 +73,10 @@ namespace ssu
void SendPeerTest (); // Alice
SessionState GetState () const { return m_State; };
-
+ size_t GetNumSentBytes () const { return m_NumSentBytes; };
+ size_t GetNumReceivedBytes () const { return m_NumReceivedBytes; };
+
+
private:
void CreateAESandMacKey (const uint8_t * pubKey);
@@ -131,6 +134,7 @@ namespace ssu
std::list m_DelayedMessages;
std::set m_ReceivedIVs;
SSUData m_Data;
+ size_t m_NumSentBytes, m_NumReceivedBytes;
};
class SSUServer