allow force_announce to only affect a single tracker
This commit is contained in:
parent
31e6d54ad2
commit
f26df6cbfa
|
@ -1,3 +1,4 @@
|
|||
* allow force_announce to only affect a single tracker
|
||||
* add moving_storage field to torrent_status
|
||||
* expose UPnP and NAT-PMP mapping in session object
|
||||
* DHT refactoring and support for storing arbitrary data with put
|
||||
|
|
|
@ -348,7 +348,8 @@ void add_piece(torrent_handle& th, int piece, char const *data, int flags)
|
|||
|
||||
void bind_torrent_handle()
|
||||
{
|
||||
void (torrent_handle::*force_reannounce0)() const = &torrent_handle::force_reannounce;
|
||||
// arguments are: number of seconds and tracker index
|
||||
void (torrent_handle::*force_reannounce0)(int, int) const = &torrent_handle::force_reannounce;
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
bool (torrent_handle::*super_seeding0)() const = &torrent_handle::super_seeding;
|
||||
|
@ -442,8 +443,11 @@ void bind_torrent_handle()
|
|||
.def("file_priority", &file_prioritity1)
|
||||
.def("save_resume_data", _(&torrent_handle::save_resume_data), arg("flags") = 0)
|
||||
.def("need_save_resume_data", _(&torrent_handle::need_save_resume_data))
|
||||
.def("force_reannounce", _(force_reannounce0))
|
||||
.def("force_reannounce", _(force_reannounce0)
|
||||
, (arg("seconds") = 0, arg("tracker_idx") = -1))
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
.def("force_reannounce", &force_reannounce)
|
||||
#endif
|
||||
#ifndef TORRENT_DISABLE_DHT
|
||||
.def("force_dht_announce", _(&torrent_handle::force_dht_announce))
|
||||
#endif
|
||||
|
|
|
@ -480,8 +480,7 @@ namespace libtorrent
|
|||
ptime next_announce() const;
|
||||
|
||||
// forcefully sets next_announce to the current time
|
||||
void force_tracker_request();
|
||||
void force_tracker_request(ptime);
|
||||
void force_tracker_request(ptime, int tracker_idx);
|
||||
void scrape_tracker();
|
||||
void announce_with_tracker(tracker_request::event_t e
|
||||
= tracker_request::none
|
||||
|
|
|
@ -862,23 +862,31 @@ namespace libtorrent
|
|||
void prioritize_files(std::vector<int> const& files) const;
|
||||
std::vector<int> file_priorities() const;
|
||||
|
||||
// ``force_reannounce()`` will force this torrent to do another tracker request, to receive new
|
||||
// peers. The second overload of ``force_reannounce`` that takes a ``time_duration`` as
|
||||
// argument will schedule a reannounce in that amount of time from now.
|
||||
// ``force_reannounce()`` will force this torrent to do another tracker
|
||||
// request, to receive new peers. The ``seconds`` argument specifies how
|
||||
// many seconds from now to issue the tracker announces.
|
||||
//
|
||||
// If the tracker's ``min_interval`` has not passed since the last announce, the forced
|
||||
// announce will be scheduled to happen immediately as the ``min_interval`` expires. This is
|
||||
// to honor trackers minimum re-announce interval settings.
|
||||
// If the tracker's ``min_interval`` has not passed since the last
|
||||
// announce, the forced announce will be scheduled to happen immediately
|
||||
// as the ``min_interval`` expires. This is to honor trackers minimum
|
||||
// re-announce interval settings.
|
||||
//
|
||||
// ``force_dht_announce`` will announce the torrent to the DHT immediately.
|
||||
void force_reannounce() const;
|
||||
// The ``tracker_index`` argument specifies which tracker to re-announce.
|
||||
// If set to -1 (which is the default), all trackers are re-announce.
|
||||
//
|
||||
// ``force_dht_announce`` will announce the torrent to the DHT
|
||||
// immediately.
|
||||
void force_reannounce(int seconds = 0, int tracker_index = -1) const;
|
||||
void force_dht_announce() const;
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
// 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;
|
||||
TORRENT_DEPRECATED_PREFIX
|
||||
void force_reannounce(boost::posix_time::time_duration) const TORRENT_DEPRECATED;
|
||||
#endif
|
||||
|
||||
// ``scrape_tracker()`` will send a scrape request to the tracker. A scrape request queries the
|
||||
// tracker for statistics such as total number of incomplete peers, complete peers, number of
|
||||
|
|
|
@ -2682,17 +2682,23 @@ namespace libtorrent
|
|||
return m_waiting_tracker?m_tracker_timer.expires_at():min_time();
|
||||
}
|
||||
|
||||
void torrent::force_tracker_request()
|
||||
{
|
||||
force_tracker_request(time_now_hires());
|
||||
}
|
||||
|
||||
void torrent::force_tracker_request(ptime t)
|
||||
void torrent::force_tracker_request(ptime t, int tracker_idx)
|
||||
{
|
||||
if (is_paused()) return;
|
||||
if (tracker_idx == -1)
|
||||
{
|
||||
for (std::vector<announce_entry>::iterator i = m_trackers.begin()
|
||||
, end(m_trackers.end()); i != end; ++i)
|
||||
i->next_announce = (std::max)(t, i->min_announce) + seconds(1);
|
||||
}
|
||||
else
|
||||
{
|
||||
TORRENT_ASSERT(tracker_idx >= 0 && tracker_idx < int(m_trackers.size()));
|
||||
if (tracker_idx < 0 || tracker_idx >= int(m_trackers.size()))
|
||||
return;
|
||||
announce_entry& e = m_trackers[tracker_idx];
|
||||
e.next_announce = (std::max)(t, e.min_announce) + seconds(1);
|
||||
}
|
||||
update_tracker_timer(time_now_hires());
|
||||
}
|
||||
|
||||
|
|
|
@ -810,11 +810,14 @@ namespace libtorrent
|
|||
TORRENT_ASYNC_CALL2(add_peer, adr, source);
|
||||
}
|
||||
|
||||
#ifndef TORRENT_NO_DEPRECATE
|
||||
void torrent_handle::force_reannounce(
|
||||
boost::posix_time::time_duration duration) const
|
||||
{
|
||||
TORRENT_ASYNC_CALL1(force_tracker_request, time_now() + seconds(duration.total_seconds()));
|
||||
TORRENT_ASYNC_CALL2(force_tracker_request, time_now()
|
||||
+ seconds(duration.total_seconds()), -1);
|
||||
}
|
||||
#endif
|
||||
|
||||
void torrent_handle::force_dht_announce() const
|
||||
{
|
||||
|
@ -823,9 +826,9 @@ namespace libtorrent
|
|||
#endif
|
||||
}
|
||||
|
||||
void torrent_handle::force_reannounce() const
|
||||
void torrent_handle::force_reannounce(int s, int idx) const
|
||||
{
|
||||
TORRENT_ASYNC_CALL1(force_tracker_request, time_now());
|
||||
TORRENT_ASYNC_CALL2(force_tracker_request, time_now() + seconds(s), idx);
|
||||
}
|
||||
|
||||
void torrent_handle::scrape_tracker() const
|
||||
|
|
Loading…
Reference in New Issue