diff --git a/bindings/python/src/torrent_handle.cpp b/bindings/python/src/torrent_handle.cpp index 06a03d8c9..52784d49d 100644 --- a/bindings/python/src/torrent_handle.cpp +++ b/bindings/python/src/torrent_handle.cpp @@ -383,7 +383,6 @@ void bind_torrent_handle() .def("resume", _(&torrent_handle::resume)) .def("stop_when_ready", _(&torrent_handle::stop_when_ready)) .def("clear_error", _(&torrent_handle::clear_error)) - .def("set_priority", _(&torrent_handle::set_priority)) .def("super_seeding", super_seeding1) .def("auto_managed", _(&torrent_handle::auto_managed)) @@ -395,6 +394,7 @@ void bind_torrent_handle() // deprecated #ifndef TORRENT_NO_DEPRECATE + .def("set_priority", _(&torrent_handle::set_priority)) .def("get_torrent_info", &get_torrent_info) .def("super_seeding", super_seeding0) .def("filter_piece", _(&torrent_handle::filter_piece)) diff --git a/bindings/python/src/torrent_status.cpp b/bindings/python/src/torrent_status.cpp index fc74eddfa..2e38394ea 100644 --- a/bindings/python/src/torrent_status.cpp +++ b/bindings/python/src/torrent_status.cpp @@ -99,12 +99,12 @@ void bind_torrent_status() .def_readonly("super_seeding", &torrent_status::super_seeding) #ifndef TORRENT_NO_DEPRECATE .def_readonly("error", &torrent_status::error) + .def_readonly("priority", &torrent_status::priority) #endif .def_readonly("errc", &torrent_status::errc) .def_readonly("error_file", &torrent_status::error_file) .def_readonly("name", &torrent_status::name) .def_readonly("save_path", &torrent_status::save_path) - .def_readonly("priority", &torrent_status::priority) .def_readonly("added_time", &torrent_status::added_time) .def_readonly("completed_time", &torrent_status::completed_time) .def_readonly("last_seen_complete", &torrent_status::last_seen_complete) diff --git a/include/libtorrent/torrent.hpp b/include/libtorrent/torrent.hpp index c627da0f1..69790e051 100644 --- a/include/libtorrent/torrent.hpp +++ b/include/libtorrent/torrent.hpp @@ -545,16 +545,6 @@ namespace libtorrent void connect_to_url_seed(std::list::iterator url); bool connect_to_peer(torrent_peer* peerinfo, bool ignore_limit = false); - int priority() const { return m_priority; } - void set_priority(int prio) - { - TORRENT_ASSERT(prio <= 255 && prio >= 0); - if (prio > 255) prio = 255; - else if (prio < 0) prio = 0; - m_priority = prio; - state_updated(); - } - // -------------------------------------------- // BANDWIDTH MANAGEMENT @@ -1535,15 +1525,19 @@ namespace libtorrent // flapping. If the state changes back during this period, we cancel the // quarantine bool m_pending_active_change:1; + // ---- // the number of bytes of padding files std::uint32_t m_padding:24; - // this is the priority of the torrent. The higher - // the value is, the more bandwidth is assigned to - // the torrent's peers - std::uint32_t m_priority:8; + // this is a second count-down to when we should tick the + // storage for this torrent. Ticking the storage is used + // to periodically flush the partfile metadata and possibly + // other deferred flushing. Any disk operation starts this + // counter (unless it's already counting down). 0 means no + // ticking is needed. + std::uint32_t m_storage_tick:8; // ---- @@ -1603,14 +1597,6 @@ namespace libtorrent // before the session started. std::int16_t m_last_upload; - // this is a second count-down to when we should tick the - // storage for this torrent. Ticking the storage is used - // to periodically flush the partfile metadata and possibly - // other deferred flushing. Any disk operation starts this - // counter (unless it's already counting down). 0 means no - // ticking is needed. - std::uint8_t m_storage_tick; - // ---- // if this is true, libtorrent may pause and resume diff --git a/include/libtorrent/torrent_handle.hpp b/include/libtorrent/torrent_handle.hpp index a465d9d2e..231a2c7f8 100644 --- a/include/libtorrent/torrent_handle.hpp +++ b/include/libtorrent/torrent_handle.hpp @@ -384,6 +384,7 @@ namespace libtorrent void reset_piece_deadline(int index) const; void clear_piece_deadlines() const; +#ifndef TORRENT_NO_DEPRECATE // This sets the bandwidth priority of this torrent. The priority of a // torrent determines how much bandwidth its peers are assigned when // distributing upload and download rate quotas. A high number gives more @@ -404,9 +405,10 @@ namespace libtorrent // distributing unchoke slots. This is a strict prioritization where // every interested peer on a high priority torrent will be unchoked // before any other, lower priority, torrents have any peers unchoked. + // deprecated in 1.2 + TORRENT_DEPRECATED void set_priority(int prio) const; -#ifndef TORRENT_NO_DEPRECATE #if !TORRENT_NO_FPU // fills the specified vector with the download progress [0, 1] // of each file in the torrent. The files are ordered as in diff --git a/include/libtorrent/torrent_status.hpp b/include/libtorrent/torrent_status.hpp index d490a29d0..b6a30927a 100644 --- a/include/libtorrent/torrent_status.hpp +++ b/include/libtorrent/torrent_status.hpp @@ -416,8 +416,13 @@ namespace libtorrent // If it has never done that, this value is -1. int last_scrape; +#ifndef TORRENT_NO_DEPRECATE // the priority of this torrent int priority; +#else + // hidden + int deprecated_priority; +#endif // the main state the torrent is in. See torrent_status::state_t. state_t state; diff --git a/src/torrent.cpp b/src/torrent.cpp index 5f15d0408..65c4f5b37 100644 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -244,7 +244,7 @@ namespace libtorrent , m_apply_ip_filter((p.flags & add_torrent_params::flag_apply_ip_filter) != 0) , m_pending_active_change(false) , m_padding(0) - , m_priority(0) + , m_storage_tick(0) , m_incomplete(0xffffff) , m_announce_to_dht((p.flags & add_torrent_params::flag_paused) == 0) , m_in_state_updates(false) @@ -257,7 +257,6 @@ namespace libtorrent , m_last_download((std::numeric_limits::min)()) , m_num_seeds(0) , m_last_upload((std::numeric_limits::min)()) - , m_storage_tick(0) , m_auto_managed((p.flags & add_torrent_params::flag_auto_managed) != 0) , m_current_gauge_state(no_gauge_state) , m_moving_storage(false) @@ -10978,6 +10977,7 @@ namespace libtorrent st->upload_mode = m_upload_mode; st->up_bandwidth_queue = 0; st->down_bandwidth_queue = 0; +#ifndef TORRENT_NO_DEPRECATE int priority = 0; for (int i = 0; i < num_classes(); ++i) { @@ -10988,6 +10988,7 @@ namespace libtorrent priority = prio[peer_connection::download_channel]; } st->priority = priority; +#endif st->num_peers = int(m_connections.size()) - m_num_connecting; diff --git a/src/torrent_handle.cpp b/src/torrent_handle.cpp index 0dc0f7942..b34589289 100644 --- a/src/torrent_handle.cpp +++ b/src/torrent_handle.cpp @@ -307,11 +307,6 @@ namespace libtorrent async_call(&torrent::auto_managed, m); } - void torrent_handle::set_priority(int p) const - { - async_call(&torrent::set_priority, p); - } - int torrent_handle::queue_position() const { return sync_call_ret(-1, &torrent::queue_position); @@ -343,6 +338,8 @@ namespace libtorrent } #ifndef TORRENT_NO_DEPRECATE + void torrent_handle::set_priority(int) const {} + void torrent_handle::set_tracker_login(std::string const& name , std::string const& password) const { diff --git a/src/torrent_status.cpp b/src/torrent_status.cpp index 8ca2cc4fe..a6568b89e 100644 --- a/src/torrent_status.cpp +++ b/src/torrent_status.cpp @@ -84,7 +84,9 @@ namespace libtorrent , seeding_time(0) , seed_rank(0) , last_scrape(0) +#ifndef TORRENT_NO_DEPRECATE , priority(0) +#endif , state(checking_resume_data) , need_save_resume(false) , ip_filter_applies(true)