forked from premiere/premiere-libtorrent
enable all disabled trackers when listen sockets are re-opened
This commit is contained in:
parent
5c869f697c
commit
9bfb108b4f
|
@ -1011,6 +1011,10 @@ namespace libtorrent {
|
||||||
std::vector<announce_entry> const& trackers() const
|
std::vector<announce_entry> const& trackers() const
|
||||||
{ return m_trackers; }
|
{ return m_trackers; }
|
||||||
|
|
||||||
|
// this sets all the "enabled" states on all trackers, giving them
|
||||||
|
// all one more chance of being tried
|
||||||
|
void enable_all_trackers();
|
||||||
|
|
||||||
void replace_trackers(std::vector<announce_entry> const& urls);
|
void replace_trackers(std::vector<announce_entry> const& urls);
|
||||||
|
|
||||||
// returns true if the tracker was added, and false if it was already
|
// returns true if the tracker was added, and false if it was already
|
||||||
|
|
|
@ -2027,6 +2027,16 @@ namespace aux {
|
||||||
#if TORRENT_USE_I2P
|
#if TORRENT_USE_I2P
|
||||||
open_new_incoming_i2p_connection();
|
open_new_incoming_i2p_connection();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
// trackers that were not reachable, may have become reachable now.
|
||||||
|
// so clear the "disabled" flags to let them be tried one more time
|
||||||
|
// TODO: it would probably be better to do this by having a
|
||||||
|
// listen-socket "version" number that gets bumped. And instead of
|
||||||
|
// setting a bool to disable a tracker, we set the version number that
|
||||||
|
// it was disabled at. This change would affect the ABI in 1.2, so
|
||||||
|
// should be done in 2.0 or later
|
||||||
|
for (auto& t : m_torrents)
|
||||||
|
t.second->enable_all_trackers();
|
||||||
}
|
}
|
||||||
|
|
||||||
void session_impl::reopen_network_sockets(reopen_network_flags_t const options)
|
void session_impl::reopen_network_sockets(reopen_network_flags_t const options)
|
||||||
|
|
|
@ -6201,6 +6201,13 @@ bool is_downloading_state(int const st)
|
||||||
return m_torrent_file;
|
return m_torrent_file;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void torrent::enable_all_trackers()
|
||||||
|
{
|
||||||
|
for (announce_entry& ae : m_trackers)
|
||||||
|
for (announce_endpoint& aep : ae.endpoints)
|
||||||
|
aep.enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
void torrent::write_resume_data(add_torrent_params& ret) const
|
void torrent::write_resume_data(add_torrent_params& ret) const
|
||||||
{
|
{
|
||||||
ret.version = LIBTORRENT_VERSION_NUM;
|
ret.version = LIBTORRENT_VERSION_NUM;
|
||||||
|
|
Loading…
Reference in New Issue