#include <bandwidth_manager.hpp>
Public Member Functions | |
| bandwidth_manager (io_service &ios, int channel) | |
| void | throttle (int limit) |
| int | throttle () const |
| void | request_bandwidth (intrusive_ptr< peer_connection > peer, bool non_prioritized) |
| void | check_invariant () const |
Private Types | |
| typedef boost::mutex | mutex_t |
Private Member Functions | |
| void | add_history_entry (history_entry const &e) |
| void | on_history_expire (asio::error_code const &e) |
| void | hand_out_bandwidth () |
Private Attributes | |
| mutex_t | m_mutex |
| io_service & | m_ios |
| deadline_timer | m_history_timer |
| int | m_limit |
| int | m_current_quota |
| std::deque< bw_queue_entry > | m_queue |
| std::deque< history_entry > | m_history |
| int | m_channel |
Definition at line 161 of file bandwidth_manager.hpp.
typedef boost::mutex libtorrent::bandwidth_manager::mutex_t [private] |
Definition at line 197 of file bandwidth_manager.hpp.
| libtorrent::bandwidth_manager::bandwidth_manager | ( | io_service & | ios, | |
| int | channel | |||
| ) |
Definition at line 32 of file bandwidth_manager.cpp.
| void libtorrent::bandwidth_manager::throttle | ( | int | limit | ) | [inline] |
Definition at line 165 of file bandwidth_manager.hpp.
References l, m_limit, and m_mutex.
Referenced by libtorrent::aux::session_impl::download_rate_limit(), libtorrent::aux::session_impl::set_download_rate_limit(), libtorrent::aux::session_impl::set_upload_rate_limit(), and libtorrent::aux::session_impl::upload_rate_limit().
| int libtorrent::bandwidth_manager::throttle | ( | ) | const [inline] |
| void libtorrent::bandwidth_manager::request_bandwidth | ( | intrusive_ptr< peer_connection > | peer, | |
| bool | non_prioritized | |||
| ) |
Definition at line 40 of file bandwidth_manager.cpp.
References hand_out_bandwidth(), INVARIANT_CHECK, asio::placeholders::iterator, m_channel, and m_queue.
Referenced by libtorrent::torrent::expire_bandwidth(), and libtorrent::torrent::request_bandwidth().
| void libtorrent::bandwidth_manager::check_invariant | ( | ) | const |
| void libtorrent::bandwidth_manager::add_history_entry | ( | history_entry const & | e | ) | [private] |
Definition at line 90 of file bandwidth_manager.cpp.
References libtorrent::history_entry::amount, asio::detail::socket_ops::bind(), libtorrent::history_entry::expires_at, INVARIANT_CHECK, m_current_quota, m_history, m_history_timer, and on_history_expire().
Referenced by hand_out_bandwidth().
| void libtorrent::bandwidth_manager::on_history_expire | ( | asio::error_code const & | e | ) | [private] |
Definition at line 108 of file bandwidth_manager.cpp.
References libtorrent::history_entry::amount, asio::detail::socket_ops::bind(), c, hand_out_bandwidth(), INVARIANT_CHECK, m_channel, m_current_quota, m_history, m_history_timer, m_queue, libtorrent::history_entry::peer, and libtorrent::history_entry::tor.
Referenced by add_history_entry().
| void libtorrent::bandwidth_manager::hand_out_bandwidth | ( | ) | [private] |
Definition at line 150 of file bandwidth_manager.cpp.
References add_history_entry(), INVARIANT_CHECK, l, m_channel, m_current_quota, m_limit, m_mutex, m_queue, libtorrent::max_bandwidth_block_size, libtorrent::min_bandwidth_block_size, libtorrent::bw_queue_entry::peer, and libtorrent::window_size.
Referenced by on_history_expire(), and request_bandwidth().
mutex_t libtorrent::bandwidth_manager::m_mutex [mutable, private] |
Definition at line 198 of file bandwidth_manager.hpp.
Referenced by hand_out_bandwidth(), and throttle().
io_service& libtorrent::bandwidth_manager::m_ios [private] |
Definition at line 201 of file bandwidth_manager.hpp.
deadline_timer libtorrent::bandwidth_manager::m_history_timer [private] |
Definition at line 206 of file bandwidth_manager.hpp.
Referenced by add_history_entry(), and on_history_expire().
int libtorrent::bandwidth_manager::m_limit [private] |
Definition at line 209 of file bandwidth_manager.hpp.
Referenced by hand_out_bandwidth(), and throttle().
int libtorrent::bandwidth_manager::m_current_quota [private] |
Definition at line 212 of file bandwidth_manager.hpp.
Referenced by add_history_entry(), check_invariant(), hand_out_bandwidth(), and on_history_expire().
std::deque<bw_queue_entry> libtorrent::bandwidth_manager::m_queue [private] |
Definition at line 215 of file bandwidth_manager.hpp.
Referenced by hand_out_bandwidth(), on_history_expire(), and request_bandwidth().
std::deque<history_entry> libtorrent::bandwidth_manager::m_history [private] |
Definition at line 219 of file bandwidth_manager.hpp.
Referenced by add_history_entry(), check_invariant(), and on_history_expire().
int libtorrent::bandwidth_manager::m_channel [private] |
Definition at line 223 of file bandwidth_manager.hpp.
Referenced by hand_out_bandwidth(), on_history_expire(), and request_bandwidth().
1.5.6