diff --git a/docs/manual.html b/docs/manual.html
index 312d337a9..fd887e7bf 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.
diff --git a/docs/manual.rst b/docs/manual.rst
index 9cf20a2aa..446e594e6 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 fb98ad98b..9aafbb921 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 66a0b0797..86d5c5990 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);