diff --git a/docs/manual.html b/docs/manual.html
index e0121cd2f..25f594bbc 100755
--- a/docs/manual.html
+++ b/docs/manual.html
@@ -5,11 +5,20 @@
libtorrent manual
+
libtorrent manual
+
Contents
diff --git a/docs/manual.rst b/docs/manual.rst
index 8cafee64b..cbaff9cf2 100755
--- a/docs/manual.rst
+++ b/docs/manual.rst
@@ -2,6 +2,8 @@
libtorrent manual
=================
+:Author: Arvid Norberg, c99ang@cs.umu.se
+
.. contents::
introduction
diff --git a/include/libtorrent/torrent.hpp b/include/libtorrent/torrent.hpp
index 296f0f5bb..fc220e0ff 100755
--- a/include/libtorrent/torrent.hpp
+++ b/include/libtorrent/torrent.hpp
@@ -222,6 +222,7 @@ namespace libtorrent
// forcefully sets next_announce to the current time
void force_tracker_request();
+ void force_tracker_request(boost::posix_time::ptime);
// sets the username and password that will be sent to
// the tracker
@@ -501,10 +502,17 @@ namespace libtorrent
inline void torrent::force_tracker_request()
{
- namespace time = boost::posix_time;
- m_next_request = time::second_clock::universal_time();
+ using boost::posix_time::second_clock;
+ m_next_request = second_clock::universal_time();
}
+ inline void torrent::force_tracker_request(boost::posix_time::ptime t)
+ {
+ namespace time = boost::posix_time;
+ m_next_request = t;
+ }
+
+
inline void torrent::set_tracker_login(
std::string const& name
, std::string const& pw)
diff --git a/include/libtorrent/torrent_handle.hpp b/include/libtorrent/torrent_handle.hpp
index 8884c3bda..4d4efd43b 100755
--- a/include/libtorrent/torrent_handle.hpp
+++ b/include/libtorrent/torrent_handle.hpp
@@ -225,6 +225,12 @@ namespace libtorrent
// (make a rerequest from the tracker)
void force_reannounce() const;
+ // forces a reannounce in the specified amount of time.
+ // This overrides the default announce interval, and no
+ // announce will take place until the given time has
+ // timed out.
+ void force_reannounce(boost::posix_time::time_duration) const;
+
// TODO: add a feature where the user can tell the torrent
// to finish all pieces currently in the pipeline, and then
// abort the torrent.
diff --git a/src/torrent_handle.cpp b/src/torrent_handle.cpp
index ae2124b36..9a0dfe1de 100755
--- a/src/torrent_handle.cpp
+++ b/src/torrent_handle.cpp
@@ -510,6 +510,22 @@ namespace libtorrent
t->get_policy().peer_from_tracker(adr, id);
}
+ void torrent_handle::force_reannounce(
+ boost::posix_time::time_duration duration) const
+ {
+ INVARIANT_CHECK;
+
+ if (m_ses == 0) throw invalid_handle();
+
+ boost::mutex::scoped_lock l(m_ses->m_mutex);
+ torrent* t = m_ses->find_torrent(m_info_hash);
+ if (t == 0) throw invalid_handle();
+
+ using boost::posix_time::second_clock;
+ t->force_tracker_request(second_clock::universal_time()
+ + duration);
+ }
+
void torrent_handle::force_reannounce() const
{
INVARIANT_CHECK;