made the minimum announce interval configurable

This commit is contained in:
Arvid Norberg 2008-08-01 22:34:37 +00:00
parent 6b2338c5dd
commit 18b14e56df
4 changed files with 23 additions and 3 deletions

View File

@ -2915,6 +2915,8 @@ struct session_settings
int auto_scrape_min_interval;
int max_peerlist_size;
int min_announce_interval;
};
</pre>
<p><tt class="docutils literal"><span class="pre">user_agent</span></tt> this is the client identification to the tracker.
@ -3126,6 +3128,10 @@ should be much greater than the maximum number of connected peers.
Peers are evicted from the cache when the list grows passed 90% of
this limit, and once the size hits the limit, peers are no longer
added to the list.</p>
<p><tt class="docutils literal"><span class="pre">min_announce_interval</span></tt> is the minimum allowed announce interval
for a tracker. This is specified in seconds, defaults to 5 minutes and
is used as a sanity check on what is returned from a tracker. It
mitigates hammering misconfigured trackers.</p>
</div>
<div class="section">
<h1><a id="pe-settings" name="pe-settings">pe_settings</a></h1>

View File

@ -2899,6 +2899,8 @@ that will be sent to the tracker. The user-agent is a good way to identify your
int auto_scrape_min_interval;
int max_peerlist_size;
int min_announce_interval;
};
``user_agent`` this is the client identification to the tracker.
@ -3165,6 +3167,12 @@ Peers are evicted from the cache when the list grows passed 90% of
this limit, and once the size hits the limit, peers are no longer
added to the list.
``min_announce_interval`` is the minimum allowed announce interval
for a tracker. This is specified in seconds, defaults to 5 minutes and
is used as a sanity check on what is returned from a tracker. It
mitigates hammering misconfigured trackers.
pe_settings
===========

View File

@ -140,6 +140,7 @@ namespace libtorrent
, auto_scrape_interval(1800)
, auto_scrape_min_interval(300)
, max_peerlist_size(8000)
, min_announce_interval(5 * 60)
{}
// this is the user agent that will be sent to the tracker
@ -430,6 +431,11 @@ namespace libtorrent
// per torrent. This is the peers we know
// about, not necessarily connected to.
int max_peerlist_size;
// any announce intervals reported from a tracker
// that is lower than this, will be clamped to this
// value. It's specified in seconds
int min_announce_interval;
};
#ifndef TORRENT_DISABLE_DHT

View File

@ -962,9 +962,9 @@ namespace libtorrent
m_complete_sent = true;
m_failed_trackers = 0;
// announce intervals less than 5 minutes
// are insane.
if (interval < 60 * 5) interval = 60 * 5;
if (interval < m_ses.settings().min_announce_interval)
interval = m_ses.settings().min_announce_interval;
m_last_working_tracker
= prioritize_tracker(m_currently_trying_tracker);