From a7b7cfa104090e45fae20d6800305bb53129c703 Mon Sep 17 00:00:00 2001 From: arvidn Date: Fri, 1 Aug 2008 22:34:37 +0000 Subject: [PATCH] made the minimum announce interval configurable git-svn-id: http://libtorrent.svn.sourceforge.net/svnroot/libtorrent/trunk@2585 a83610d8-ad2a-0410-a6ab-fc0612d85776 --- docs/manual.html | 6 ++++++ docs/manual.rst | 8 ++++++++ include/libtorrent/session_settings.hpp | 6 ++++++ src/torrent.cpp | 6 +++--- 4 files changed, 23 insertions(+), 3 deletions(-) diff --git a/docs/manual.html b/docs/manual.html index 312d337a..fd887e7b 100644 --- a/docs/manual.html +++ b/docs/manual.html @@ -2915,6 +2915,8 @@ struct session_settings int auto_scrape_min_interval; int max_peerlist_size; + + int min_announce_interval; };

user_agent 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.

+

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

diff --git a/docs/manual.rst b/docs/manual.rst index 9cf20a2a..446e594e 100644 --- a/docs/manual.rst +++ b/docs/manual.rst @@ -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 =========== diff --git a/include/libtorrent/session_settings.hpp b/include/libtorrent/session_settings.hpp index fb98ad98..9aafbb92 100644 --- a/include/libtorrent/session_settings.hpp +++ b/include/libtorrent/session_settings.hpp @@ -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 diff --git a/src/torrent.cpp b/src/torrent.cpp index 66a0b079..86d5c599 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -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); -- 2.11.4.GIT