diff --git a/include/libtorrent/aux_/session_impl.hpp b/include/libtorrent/aux_/session_impl.hpp index 9197af5fd..8fb0ffb29 100644 --- a/include/libtorrent/aux_/session_impl.hpp +++ b/include/libtorrent/aux_/session_impl.hpp @@ -468,7 +468,7 @@ namespace aux { 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(peer_class_t cid); + peer_class_info get_peer_class(peer_class_t cid) const; 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 05416c538..0da41acd7 100644 --- a/include/libtorrent/session_handle.hpp +++ b/include/libtorrent/session_handle.hpp @@ -698,7 +698,7 @@ namespace libtorrent { // account. // // For more information, see peer-classes_. - peer_class_info get_peer_class(peer_class_t cid); + peer_class_info get_peer_class(peer_class_t cid) const; void set_peer_class(peer_class_t cid, peer_class_info const& pci); #ifndef TORRENT_NO_DEPRECATE diff --git a/src/session_handle.cpp b/src/session_handle.cpp index ca293e71e..fc396bc4c 100644 --- a/src/session_handle.cpp +++ b/src/session_handle.cpp @@ -840,7 +840,7 @@ namespace { async_call(&session_impl::delete_peer_class, cid); } - peer_class_info session_handle::get_peer_class(peer_class_t cid) + peer_class_info session_handle::get_peer_class(peer_class_t cid) const { return sync_call_ret(&session_impl::get_peer_class, cid); } diff --git a/src/session_impl.cpp b/src/session_impl.cpp index be4567fec..c5f464ec8 100644 --- a/src/session_impl.cpp +++ b/src/session_impl.cpp @@ -1091,12 +1091,12 @@ namespace { m_classes.decref(cid); } - peer_class_info session_impl::get_peer_class(peer_class_t cid) + peer_class_info session_impl::get_peer_class(peer_class_t const cid) const { peer_class_info ret; - peer_class* pc = m_classes.at(cid); + peer_class const* pc = m_classes.at(cid); // if you hit this assert, you're passing in an invalid cid - TORRENT_ASSERT(pc); + TORRENT_ASSERT_PRECOND(pc); if (pc == nullptr) { #if TORRENT_USE_INVARIANT_CHECKS diff --git a/test/test_session.cpp b/test/test_session.cpp index e27c1b8af..9cfd41a75 100644 --- a/test/test_session.cpp +++ b/test/test_session.cpp @@ -445,7 +445,7 @@ TORRENT_TEST(init_dht) auto count_dht_inits = [](session& ses) { int count = 0; - int num = 70; // this number is adjusted per version, an estimate + int num = 120; // this number is adjusted per version, an estimate time_point const end_time = clock_type::now() + seconds(15); while (true) {