made recent change where the TCP/IP overhead is take into account when rate limiting, optional

This commit is contained in:
Arvid Norberg 2008-11-18 11:14:44 +00:00
parent ce24a17308
commit 78abf8a340
3 changed files with 25 additions and 8 deletions

View File

@ -3038,6 +3038,8 @@ that will be sent to the tracker. The user-agent is a good way to identify your
bool prioritize_partial_pieces; bool prioritize_partial_pieces;
int auto_manage_startup; int auto_manage_startup;
bool rate_limit_ip_overhead;
}; };
``user_agent`` this is the client identification to the tracker. ``user_agent`` this is the client identification to the tracker.
@ -3319,6 +3321,9 @@ active after it was started, regardless of upload and download speed. This
is so that newly started torrents are not considered inactive until they is so that newly started torrents are not considered inactive until they
have a fair chance to start downloading. have a fair chance to start downloading.
If ``rate_limit_ip_overhead`` is set to true, the estimated TCP/IP overhead is
drained from the rate limiters, to avoid exceeding the limits with the total traffic
pe_settings pe_settings
=========== ===========

View File

@ -143,6 +143,7 @@ namespace libtorrent
, min_announce_interval(5 * 60) , min_announce_interval(5 * 60)
, prioritize_partial_pieces(false) , prioritize_partial_pieces(false)
, auto_manage_startup(120) , auto_manage_startup(120)
, rate_limit_ip_overhead(true)
{} {}
// this is the user agent that will be sent to the tracker // this is the user agent that will be sent to the tracker
@ -450,6 +451,11 @@ namespace libtorrent
// inactive until they have a fair chance to // inactive until they have a fair chance to
// start downloading. // start downloading.
int auto_manage_startup; int auto_manage_startup;
// if set to true, the estimated TCP/IP overhead is
// drained from the rate limiters, to avoid exceeding
// the limits with the total traffic
bool rate_limit_ip_overhead;
}; };
#ifndef TORRENT_DISABLE_DHT #ifndef TORRENT_DISABLE_DHT

View File

@ -1121,10 +1121,13 @@ namespace aux {
} }
// drain the IP overhead from the bandwidth limiters // drain the IP overhead from the bandwidth limiters
m_download_channel.drain( if (m_settings.rate_limit_ip_overhead)
m_stat.download_ip_overhead() {
+ m_stat.download_dht() m_download_channel.drain(
+ m_stat.download_tracker()); m_stat.download_ip_overhead()
+ m_stat.download_dht()
+ m_stat.download_tracker());
}
if (m_stat.download_ip_overhead() >= m_download_channel.throttle() if (m_stat.download_ip_overhead() >= m_download_channel.throttle()
&& m_alerts.should_post<performance_alert>()) && m_alerts.should_post<performance_alert>())
@ -1133,10 +1136,13 @@ namespace aux {
, performance_alert::download_limit_too_low)); , performance_alert::download_limit_too_low));
} }
m_upload_channel.drain( if (m_settings.rate_limit_ip_overhead)
m_stat.upload_ip_overhead() {
+ m_stat.upload_dht() m_upload_channel.drain(
+ m_stat.upload_tracker()); m_stat.upload_ip_overhead()
+ m_stat.upload_dht()
+ m_stat.upload_tracker());
}
if (m_stat.upload_ip_overhead() >= m_upload_channel.throttle() if (m_stat.upload_ip_overhead() >= m_upload_channel.throttle()
&& m_alerts.should_post<performance_alert>()) && m_alerts.should_post<performance_alert>())