fix DHT announce timer issue
This commit is contained in:
@ -1,3 +1,5 @@
|
||||
* fix DHT announce timer issue
|
||||
|
||||
* 2.0.5 released
|
||||
|
||||
* on windows, explicitly flush memory mapped files periodically
|
||||
|
@ -3795,22 +3795,7 @@ namespace {
|
||||
|
||||
TORRENT_ASSERT(m_dht);
|
||||
|
||||
// announce to DHT every 15 minutes
|
||||
int delay = std::max(m_settings.get_int(settings_pack::dht_announce_interval)
|
||||
/ std::max(int(m_torrents.size()), 1), 1);
|
||||
|
||||
if (!m_dht_torrents.empty())
|
||||
{
|
||||
// we have prioritized torrents that need
|
||||
// an initial DHT announce. Don't wait too long
|
||||
// until we announce those.
|
||||
delay = std::min(4, delay);
|
||||
}
|
||||
|
||||
ADD_OUTSTANDING_ASYNC("session_impl::on_dht_announce");
|
||||
m_dht_announce_timer.expires_after(seconds(delay));
|
||||
m_dht_announce_timer.async_wait([this](error_code const& err)
|
||||
{ wrap(&session_impl::on_dht_announce, err); });
|
||||
update_dht_announce_interval();
|
||||
|
||||
if (!m_dht_torrents.empty())
|
||||
{
|
||||
@ -6557,6 +6542,15 @@ namespace {
|
||||
ADD_OUTSTANDING_ASYNC("session_impl::on_dht_announce");
|
||||
int delay = std::max(m_settings.get_int(settings_pack::dht_announce_interval)
|
||||
/ std::max(int(m_torrents.size()), 1), 1);
|
||||
|
||||
if (!m_dht_torrents.empty())
|
||||
{
|
||||
// we have prioritized torrents that need
|
||||
// an initial DHT announce. Don't wait too long
|
||||
// until we announce those.
|
||||
delay = std::min(4, delay);
|
||||
}
|
||||
|
||||
m_dht_announce_timer.expires_after(seconds(delay));
|
||||
m_dht_announce_timer.async_wait([this](error_code const& e) {
|
||||
wrap(&session_impl::on_dht_announce, e); });
|
||||
|
Reference in New Issue
Block a user