forked from premiere/premiere-libtorrent
fix for torrent announcing bug introduced when supporting fine grained control over sources torrents are announced to
This commit is contained in:
parent
3ae927abb4
commit
4c4c7f832a
|
@ -252,6 +252,7 @@ namespace libtorrent
|
|||
void flush_cache();
|
||||
void pause();
|
||||
void resume();
|
||||
void set_allow_peers(bool b);
|
||||
void set_announce_to_dht(bool b) { m_announce_to_dht = b; }
|
||||
void set_announce_to_trackers(bool b) { m_announce_to_trackers = b; }
|
||||
void set_announce_to_lsd(bool b) { m_announce_to_lsd = b; }
|
||||
|
|
|
@ -2377,11 +2377,11 @@ namespace aux {
|
|||
--tracker_limit;
|
||||
t->set_announce_to_dht(dht_limit >= 0);
|
||||
t->set_announce_to_trackers(tracker_limit >= 0);
|
||||
if (t->is_paused()) t->resume();
|
||||
t->set_allow_peers(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!t->is_paused()) t->pause();
|
||||
t->set_allow_peers(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5335,6 +5335,30 @@ namespace libtorrent
|
|||
stop_announcing();
|
||||
}
|
||||
|
||||
void torrent::set_allow_peers(bool b)
|
||||
{
|
||||
if (m_allow_peers == b) return;
|
||||
|
||||
bool checking_files = should_check_files();
|
||||
|
||||
m_allow_peers = b;
|
||||
|
||||
if (!b)
|
||||
{
|
||||
m_announce_to_dht = false;
|
||||
m_announce_to_trackers = false;
|
||||
m_announce_to_lsd = false;
|
||||
do_pause();
|
||||
}
|
||||
else
|
||||
{
|
||||
do_resume();
|
||||
}
|
||||
|
||||
if (!checking_files && should_check_files())
|
||||
queue_torrent_check();
|
||||
}
|
||||
|
||||
void torrent::resume()
|
||||
{
|
||||
INVARIANT_CHECK;
|
||||
|
@ -5345,12 +5369,9 @@ namespace libtorrent
|
|||
&& m_announce_to_lsd) return;
|
||||
bool checking_files = should_check_files();
|
||||
m_allow_peers = true;
|
||||
if (!m_auto_managed)
|
||||
{
|
||||
m_announce_to_dht = true;
|
||||
m_announce_to_trackers = true;
|
||||
m_announce_to_lsd = true;
|
||||
}
|
||||
m_announce_to_dht = true;
|
||||
m_announce_to_trackers = true;
|
||||
m_announce_to_lsd = true;
|
||||
do_resume();
|
||||
if (!checking_files && should_check_files())
|
||||
queue_torrent_check();
|
||||
|
|
Loading…
Reference in New Issue