diff --git a/include/libtorrent/aux_/session_impl.hpp b/include/libtorrent/aux_/session_impl.hpp index 7894e1c67..d45784bb1 100644 --- a/include/libtorrent/aux_/session_impl.hpp +++ b/include/libtorrent/aux_/session_impl.hpp @@ -454,15 +454,15 @@ namespace libtorrent bool use_quota_overhead(bandwidth_channel* ch, int amount); peer_class_t create_peer_class(char const* name); - void delete_peer_class(int cid); + void delete_peer_class(peer_class_t cid); void set_peer_class_filter(ip_filter const& f); ip_filter const& get_peer_class_filter() const; void set_peer_class_type_filter(peer_class_type_filter f); peer_class_type_filter get_peer_class_type_filter(); - peer_class_info get_peer_class(int cid); - void set_peer_class(int cid, peer_class_info const& pci); + peer_class_info get_peer_class(peer_class_t cid); + void set_peer_class(peer_class_t cid, peer_class_info const& pci); bool is_listening() const; diff --git a/include/libtorrent/session_handle.hpp b/include/libtorrent/session_handle.hpp index e5c5c0643..7bfdce1a5 100644 --- a/include/libtorrent/session_handle.hpp +++ b/include/libtorrent/session_handle.hpp @@ -681,7 +681,7 @@ namespace libtorrent // destructs. // // For more information on peer classes, see peer-classes_. - void delete_peer_class(int cid); + void delete_peer_class(peer_class_t cid); // These functions queries information from a peer class and updates the // configuration of a peer class, respectively. @@ -698,8 +698,8 @@ namespace libtorrent // account. // // For more information, see peer-classes_. - peer_class_info get_peer_class(int cid); - void set_peer_class(int cid, peer_class_info const& pci); + peer_class_info get_peer_class(peer_class_t cid); + void set_peer_class(peer_class_t cid, peer_class_info const& pci); #ifndef TORRENT_NO_DEPRECATE // if the listen port failed in some way you can retry to listen on diff --git a/src/session_handle.cpp b/src/session_handle.cpp index f0113a46a..8d940926e 100644 --- a/src/session_handle.cpp +++ b/src/session_handle.cpp @@ -774,17 +774,17 @@ namespace libtorrent return sync_call_ret(&session_impl::create_peer_class, name); } - void session_handle::delete_peer_class(int cid) + void session_handle::delete_peer_class(peer_class_t cid) { async_call(&session_impl::delete_peer_class, cid); } - peer_class_info session_handle::get_peer_class(int cid) + peer_class_info session_handle::get_peer_class(peer_class_t cid) { return sync_call_ret(&session_impl::get_peer_class, cid); } - void session_handle::set_peer_class(int cid, peer_class_info const& pci) + void session_handle::set_peer_class(peer_class_t cid, peer_class_info const& pci) { async_call(&session_impl::set_peer_class, cid, pci); } diff --git a/src/session_impl.cpp b/src/session_impl.cpp index 900cdd782..cc5914f42 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -1122,19 +1122,19 @@ namespace aux { return m_classes.new_peer_class(name); } - void session_impl::delete_peer_class(int cid) + void session_impl::delete_peer_class(peer_class_t cid) { TORRENT_ASSERT(is_single_thread()); // if you hit this assert, you're deleting a non-existent peer class - TORRENT_ASSERT(m_classes.at(peer_class_t(cid))); - if (m_classes.at(peer_class_t(cid)) == nullptr) return; - m_classes.decref(peer_class_t(cid)); + TORRENT_ASSERT(m_classes.at(cid)); + if (m_classes.at(cid) == nullptr) return; + m_classes.decref(cid); } - peer_class_info session_impl::get_peer_class(int cid) + peer_class_info session_impl::get_peer_class(peer_class_t cid) { peer_class_info ret; - peer_class* pc = m_classes.at(peer_class_t(cid)); + peer_class* pc = m_classes.at(cid); // if you hit this assert, you're passing in an invalid cid TORRENT_ASSERT(pc); if (pc == nullptr) @@ -1183,9 +1183,9 @@ namespace aux { m_tracker_manager.queue_request(get_io_service(), req, c); } - void session_impl::set_peer_class(int cid, peer_class_info const& pci) + void session_impl::set_peer_class(peer_class_t cid, peer_class_info const& pci) { - peer_class* pc = m_classes.at(peer_class_t(cid)); + peer_class* pc = m_classes.at(cid); // if you hit this assert, you're passing in an invalid cid TORRENT_ASSERT(pc); if (pc == nullptr) return;