diff --git a/ChangeLog b/ChangeLog index 54180e9ad..b3020cfe3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -73,6 +73,7 @@ * almost completely changed the storage interface (for custom storage) * added support for hashing pieces in multiple threads + * fix bug where dont_count_slow_torrents could not be disabled * fix fallocate hack on linux (fixes corruption on some architectures) * fix auto-manage bug with announce to tracker/lsd/dht limits * improve DHT routing table to not create an unbalanced tree diff --git a/include/libtorrent/torrent.hpp b/include/libtorrent/torrent.hpp index 2f3761512..cc3ede5a8 100644 --- a/include/libtorrent/torrent.hpp +++ b/include/libtorrent/torrent.hpp @@ -929,32 +929,13 @@ namespace libtorrent void add_failed_bytes(int b); // this is true if we have all the pieces, but not necessarily flushed them to disk - bool is_seed() const - { - if (!valid_metadata()) return false; - if (m_seed_mode) return true; - if (m_have_all) return true; - if (m_picker && m_picker->num_passed() == m_picker->num_pieces()) return true; - return m_state == torrent_status::seeding; - } + bool is_seed() const; // this is true if we have all the pieces that we want // the pieces don't necessarily need to be flushed to disk - bool is_finished() const - { - if (is_seed()) return true; + bool is_finished() const; - // this is slightly different from m_picker->is_finished() - // because any piece that has *passed* is considered here, - // which may be more than the piece we *have* (i.e. written to disk) - // keep in mind that num_filtered() does not include pieces we - // have that are filtered - return valid_metadata() && has_picker() - && m_torrent_file->num_pieces() - m_picker->num_filtered() - m_picker->num_passed() == 0; - } - - bool is_inactive() const - { return m_inactive; } + bool is_inactive() const; std::string save_path() const; alert_manager& alerts() const; diff --git a/src/torrent.cpp b/src/torrent.cpp index b534ed361..9cff64746 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -8623,6 +8623,35 @@ namespace libtorrent return m_ses.alerts(); } + bool torrent::is_seed() const + { + if (!valid_metadata()) return false; + if (m_seed_mode) return true; + if (m_have_all) return true; + if (m_picker && m_picker->num_passed() == m_picker->num_pieces()) return true; + return m_state == torrent_status::seeding; + } + + bool torrent::is_finished() const + { + if (is_seed()) return true; + + // this is slightly different from m_picker->is_finished() + // because any piece that has *passed* is considered here, + // which may be more than the piece we *have* (i.e. written to disk) + // keep in mind that num_filtered() does not include pieces we + // have that are filtered + return valid_metadata() && has_picker() + && m_torrent_file->num_pieces() - m_picker->num_filtered() - m_picker->num_passed() == 0; + } + + bool torrent::is_inactive() const + { + if (!settings().get_bool(settings_pack::dont_count_slow_torrents)) + return false; + return m_inactive; + } + std::string torrent::save_path() const { return m_save_path;