announces torrents immediately to the DHT when it's started
This commit is contained in:
parent
65eb4db727
commit
6c137d6ef6
|
@ -74,6 +74,7 @@
|
||||||
* added torrent_status::finished_time
|
* added torrent_status::finished_time
|
||||||
* automatically caps files and connections by default to rlimit
|
* automatically caps files and connections by default to rlimit
|
||||||
* added session::is_dht_running() function
|
* added session::is_dht_running() function
|
||||||
|
* added torrent_handle::force_dht_announce()
|
||||||
|
|
||||||
release 0.14.7
|
release 0.14.7
|
||||||
|
|
||||||
|
@ -88,6 +89,7 @@ release 0.14.7
|
||||||
was received
|
was received
|
||||||
* fixed incorrect error when deleting files from a torrent where
|
* fixed incorrect error when deleting files from a torrent where
|
||||||
not all files have been created
|
not all files have been created
|
||||||
|
* announces torrents immediately to the DHT when it's started
|
||||||
|
|
||||||
release 0.14.6
|
release 0.14.6
|
||||||
|
|
||||||
|
|
|
@ -353,6 +353,7 @@ void bind_torrent_handle()
|
||||||
.def("save_resume_data", _(&torrent_handle::save_resume_data))
|
.def("save_resume_data", _(&torrent_handle::save_resume_data))
|
||||||
.def("force_reannounce", _(force_reannounce0))
|
.def("force_reannounce", _(force_reannounce0))
|
||||||
.def("force_reannounce", &force_reannounce)
|
.def("force_reannounce", &force_reannounce)
|
||||||
|
.def("force_dht_announce", _(&torrent_handle::force_dht_announce))
|
||||||
.def("scrape_tracker", _(&torrent_handle::scrape_tracker))
|
.def("scrape_tracker", _(&torrent_handle::scrape_tracker))
|
||||||
.def("name", _(&torrent_handle::name))
|
.def("name", _(&torrent_handle::name))
|
||||||
.def("set_upload_limit", _(&torrent_handle::set_upload_limit))
|
.def("set_upload_limit", _(&torrent_handle::set_upload_limit))
|
||||||
|
|
|
@ -1863,6 +1863,7 @@ Its declaration looks like this::
|
||||||
|
|
||||||
void save_resume_data() const;
|
void save_resume_data() const;
|
||||||
void force_reannounce() const;
|
void force_reannounce() const;
|
||||||
|
void force_dht_announce() const;
|
||||||
void force_reannounce(boost::posix_time::time_duration) const;
|
void force_reannounce(boost::posix_time::time_duration) const;
|
||||||
void scrape_tracker() const;
|
void scrape_tracker() const;
|
||||||
void connect_peer(asio::ip::tcp::endpoint const& adr, int source = 0) const;
|
void connect_peer(asio::ip::tcp::endpoint const& adr, int source = 0) const;
|
||||||
|
@ -2188,18 +2189,21 @@ read_piece_alert_. In order to receive this alert, you must enable
|
||||||
Note that if you read multiple pieces, the read operations are not guaranteed to
|
Note that if you read multiple pieces, the read operations are not guaranteed to
|
||||||
finish in the same order as you initiated them.
|
finish in the same order as you initiated them.
|
||||||
|
|
||||||
force_reannounce()
|
force_reannounce() force_dht_announce()
|
||||||
------------------
|
---------------------------------------
|
||||||
|
|
||||||
::
|
::
|
||||||
|
|
||||||
void force_reannounce() const;
|
void force_reannounce() const;
|
||||||
void force_reannounce(boost::posix_time::time_duration) const;
|
void force_reannounce(boost::posix_time::time_duration) const;
|
||||||
|
void force_dht_announce() const;
|
||||||
|
|
||||||
``force_reannounce()`` will force this torrent to do another tracker request, to receive new
|
``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
|
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.
|
argument will schedule a reannounce in that amount of time from now.
|
||||||
|
|
||||||
|
``force_dht_announce`` will announce the torrent to the DHT immediately.
|
||||||
|
|
||||||
scrape_tracker()
|
scrape_tracker()
|
||||||
----------------
|
----------------
|
||||||
|
|
||||||
|
|
|
@ -412,6 +412,10 @@ namespace libtorrent
|
||||||
, address const& bind_interface = address_v4::any());
|
, address const& bind_interface = address_v4::any());
|
||||||
ptime const& last_scrape() const { return m_last_scrape; }
|
ptime const& last_scrape() const { return m_last_scrape; }
|
||||||
|
|
||||||
|
#ifndef TORRENT_DISABLE_DHT
|
||||||
|
void force_dht_announce();
|
||||||
|
#endif
|
||||||
|
|
||||||
// sets the username and password that will be sent to
|
// sets the username and password that will be sent to
|
||||||
// the tracker
|
// the tracker
|
||||||
void set_tracker_login(std::string const& name, std::string const& pw);
|
void set_tracker_login(std::string const& name, std::string const& pw);
|
||||||
|
|
|
@ -511,6 +511,10 @@ namespace libtorrent
|
||||||
// forces this torrent to reannounce
|
// forces this torrent to reannounce
|
||||||
// (make a rerequest from the tracker)
|
// (make a rerequest from the tracker)
|
||||||
void force_reannounce() const;
|
void force_reannounce() const;
|
||||||
|
#ifndef TORRENT_DISABLE_DHT
|
||||||
|
// announces this torrent to the DHT immediately
|
||||||
|
void force_dht_announce() const;
|
||||||
|
#endif
|
||||||
|
|
||||||
// forces a reannounce in the specified amount of time.
|
// forces a reannounce in the specified amount of time.
|
||||||
// This overrides the default announce interval, and no
|
// This overrides the default announce interval, and no
|
||||||
|
|
|
@ -2570,6 +2570,13 @@ namespace aux {
|
||||||
std::list<std::pair<std::string, int> >().swap(m_dht_router_nodes);
|
std::list<std::pair<std::string, int> >().swap(m_dht_router_nodes);
|
||||||
|
|
||||||
m_dht->start(startup_state);
|
m_dht->start(startup_state);
|
||||||
|
|
||||||
|
// announce all torrents we have to the DHT
|
||||||
|
for (torrent_map::const_iterator i = m_torrents.begin()
|
||||||
|
, end(m_torrents.end()); i != end; ++i)
|
||||||
|
{
|
||||||
|
i->second->force_dht_announce();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifndef TORRENT_DISABLE_DHT
|
#ifndef TORRENT_DISABLE_DHT
|
||||||
|
|
|
@ -359,6 +359,18 @@ namespace libtorrent
|
||||||
|
|
||||||
return verified_trackers == 0;
|
return verified_trackers == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void torrent::force_dht_announce()
|
||||||
|
{
|
||||||
|
m_last_dht_announce = min_time();
|
||||||
|
// DHT announces are done on the local service
|
||||||
|
// discovery timer. Trigger it.
|
||||||
|
error_code ec;
|
||||||
|
boost::weak_ptr<torrent> self(shared_from_this());
|
||||||
|
m_lsd_announce_timer.expires_from_now(seconds(1), ec);
|
||||||
|
m_lsd_announce_timer.async_wait(
|
||||||
|
bind(&torrent::on_lsd_announce_disp, self, _1));
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
torrent::~torrent()
|
torrent::~torrent()
|
||||||
|
|
|
@ -661,6 +661,14 @@ namespace libtorrent
|
||||||
TORRENT_FORWARD(force_tracker_request(time_now() + seconds(duration.total_seconds())));
|
TORRENT_FORWARD(force_tracker_request(time_now() + seconds(duration.total_seconds())));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef TORRENT_DISABLE_DHT
|
||||||
|
void torrent_handle::force_dht_announce() const
|
||||||
|
{
|
||||||
|
INVARIANT_CHECK;
|
||||||
|
TORRENT_FORWARD(force_dht_announce());
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
void torrent_handle::force_reannounce() const
|
void torrent_handle::force_reannounce() const
|
||||||
{
|
{
|
||||||
INVARIANT_CHECK;
|
INVARIANT_CHECK;
|
||||||
|
|
Loading…
Reference in New Issue