report tracker bandwidth usage and include it in rate limiter

This commit is contained in:
Arvid Norberg
2008-09-22 00:15:05 +00:00
parent 48dad0e2ac
commit 1ac3b8298c
9 changed files with 97 additions and 11 deletions

View File

@@ -208,6 +208,7 @@ namespace libtorrent
// ignore packet not sent from the tracker
if (m_target != ep) return;
received_bytes(size + 28); // assuming UDP/IP header
if (e) fail(-1, e.message().c_str());
#if defined TORRENT_VERBOSE_LOGGING || defined TORRENT_LOGGING
@@ -320,6 +321,7 @@ namespace libtorrent
error_code ec;
m_socket.send(m_target, buf, 16, ec);
m_state = action_connect;
sent_bytes(16 + 28); // assuming UDP/IP header
++m_attempts;
if (ec)
{
@@ -349,6 +351,7 @@ namespace libtorrent
error_code ec;
m_socket.send(m_target, buf, sizeof(buf), ec);
m_state = action_scrape;
sent_bytes(sizeof(buf) + 28); // assuming UDP/IP header
++m_attempts;
if (ec)
{
@@ -509,6 +512,7 @@ namespace libtorrent
error_code ec;
m_socket.send(m_target, buf, sizeof(buf), ec);
m_state = action_announce;
sent_bytes(sizeof(buf) + 28); // assuming UDP/IP header
++m_attempts;
if (ec)
{