added functions to query an individual peer's upload and download limit
This commit is contained in:
@@ -5212,6 +5212,24 @@ namespace libtorrent
|
||||
m_max_connections = limit;
|
||||
}
|
||||
|
||||
int torrent::get_peer_upload_limit(tcp::endpoint ip) const
|
||||
{
|
||||
TORRENT_ASSERT(m_ses.is_network_thread());
|
||||
peer_iterator i = std::find_if(m_connections.begin(), m_connections.end()
|
||||
, boost::bind(&peer_connection::remote, _1) == ip);
|
||||
if (i == m_connections.end()) return -1;
|
||||
return (*i)->get_upload_limit();
|
||||
}
|
||||
|
||||
int torrent::get_peer_download_limit(tcp::endpoint ip) const
|
||||
{
|
||||
TORRENT_ASSERT(m_ses.is_network_thread());
|
||||
peer_iterator i = std::find_if(m_connections.begin(), m_connections.end()
|
||||
, boost::bind(&peer_connection::remote, _1) == ip);
|
||||
if (i == m_connections.end()) return -1;
|
||||
return (*i)->get_download_limit();
|
||||
}
|
||||
|
||||
void torrent::set_peer_upload_limit(tcp::endpoint ip, int limit)
|
||||
{
|
||||
TORRENT_ASSERT(m_ses.is_network_thread());
|
||||
|
Reference in New Issue
Block a user