more use of peer_class_t in public API

This commit is contained in:
Alden Torres 2017-01-22 12:06:52 -05:00 committed by Arvid Norberg
parent 06c68052b4
commit 8b98bf2c9d
4 changed files with 17 additions and 17 deletions

View File

@ -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;

View File

@ -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

View File

@ -774,17 +774,17 @@ namespace libtorrent
return sync_call_ret<peer_class_t>(&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<peer_class_info>(&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);
}

View File

@ -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;