make DHT rate limit configurable

This commit is contained in:
Arvid Norberg 2011-03-14 07:47:24 +00:00
parent 4ecb9f1462
commit 9812626cf0
4 changed files with 21 additions and 0 deletions

View File

@ -4341,6 +4341,7 @@ session_settings
int download_rate_limit;
int local_upload_rate_limit;
int local_download_rate_limit;
int dht_upload_rate_limit;
int unchoke_slots_limit;
int half_open_limit;
int connections_limit;
@ -5103,6 +5104,10 @@ quite unthrottled.
A value of 0 means unlimited.
``dht_upload_rate_limit`` sets the rate limit on the DHT. This is specified in
bytes per second and defaults to 4000. For busy boxes with lots of torrents
that requires more DHT traffic, this should be raised.
``unchoke_slots_limit`` is the mac number of unchoked peers in the session.
The number of unchoke slots may be ignored depending on what

View File

@ -242,6 +242,7 @@ namespace libtorrent
, download_rate_limit(0)
, local_upload_rate_limit(0)
, local_download_rate_limit(0)
, dht_upload_rate_limit(4000)
, unchoke_slots_limit(8)
, half_open_limit(0)
, connections_limit(200)
@ -953,6 +954,9 @@ namespace libtorrent
// network, in the session
int local_download_rate_limit;
// max upload rate used by the DHT in bytes per second
int dht_upload_rate_limit;
// the max number of unchoke slots in the session (might be
// overridden by unchoke algorithm)
int unchoke_slots_limit;

View File

@ -205,6 +205,10 @@ namespace libtorrent
// unchoke many peers
set.unchoke_slots_limit = 500;
// we need more DHT capacity to ping more peers
// candidates before trying to connect
set.dht_upload_rate_limit = 100000;
// use 1 GB of cache
set.cache_size = 32768 * 2;
set.use_read_cache = true;

View File

@ -339,6 +339,7 @@ namespace aux {
TORRENT_SETTING(integer, download_rate_limit)
TORRENT_SETTING(integer, local_upload_rate_limit)
TORRENT_SETTING(integer, local_download_rate_limit)
TORRENT_SETTING(integer, dht_upload_rate_limit)
TORRENT_SETTING(integer, unchoke_slots_limit)
TORRENT_SETTING(integer, half_open_limit)
TORRENT_SETTING(integer, connections_limit)
@ -360,6 +361,8 @@ namespace aux {
TORRENT_SETTING(integer, alert_queue_size)
TORRENT_SETTING(integer, max_metadata_size)
TORRENT_SETTING(integer, smooth_connects)
TORRENT_SETTING(boolean, always_send_user_agent)
TORRENT_SETTING(boolean, apply_ip_filter_to_trackers)
};
#undef TORRENT_SETTING
@ -541,6 +544,8 @@ namespace aux {
, m_network_thread(0)
#endif
{
m_udp_socket.set_rate_limit(m_settings.dht_upload_rate_limit);
m_disk_queues[0] = 0;
m_disk_queues[1] = 0;
@ -1652,6 +1657,9 @@ namespace aux {
if (m_settings.alert_queue_size != s.alert_queue_size)
m_alerts.set_alert_queue_size_limit(s.alert_queue_size);
if (m_settings.dht_upload_rate_limit != s.dht_upload_rate_limit)
m_udp_socket.set_rate_limit(s.dht_upload_rate_limit);
m_settings = s;
update_rate_settings();