* Refactoring of choke_queue and how choking is handled.

* Added 'd.{up,down}loads_{max,min}', and the keys 1/2/3/4 and !/@/#/$ control these.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1274 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2011-09-07 03:53:38 +00:00
parent 1b49dcb9e0
commit 1e83c626f8
4 changed files with 46 additions and 7 deletions
+33 -6
View File
@@ -303,6 +303,27 @@ Download::receive_max_uploads(int t) {
m_download->download()->set_uploads_max(std::max<int32_t>(m_download->download()->uploads_max() + t, 0));
}
void
Download::receive_min_uploads(int t) {
m_windowDownloadStatus->mark_dirty();
m_download->download()->set_uploads_min(std::max<int32_t>(m_download->download()->uploads_min() + t, 0));
}
void
Download::receive_max_downloads(int t) {
m_windowDownloadStatus->mark_dirty();
m_download->download()->set_downloads_max(std::max<int32_t>(m_download->download()->downloads_max() + t, 0));
}
void
Download::receive_min_downloads(int t) {
m_windowDownloadStatus->mark_dirty();
m_download->download()->set_downloads_min(std::max<int32_t>(m_download->download()->downloads_min() + t, 0));
}
void
Download::receive_min_peers(int t) {
m_windowDownloadStatus->mark_dirty();
@@ -355,12 +376,18 @@ Download::adjust_up_throttle(int throttle) {
void
Download::bind_keys() {
m_bindings['1'] = sigc::bind(sigc::mem_fun(this, &Download::receive_max_uploads), -1);
m_bindings['2'] = sigc::bind(sigc::mem_fun(this, &Download::receive_max_uploads), 1);
m_bindings['3'] = sigc::bind(sigc::mem_fun(this, &Download::receive_min_peers), -5);
m_bindings['4'] = sigc::bind(sigc::mem_fun(this, &Download::receive_min_peers), 5);
m_bindings['5'] = sigc::bind(sigc::mem_fun(this, &Download::receive_max_peers), -5);
m_bindings['6'] = sigc::bind(sigc::mem_fun(this, &Download::receive_max_peers), 5);
m_bindings['1'] = sigc::bind(sigc::mem_fun(this, &Download::receive_min_uploads), -1);
m_bindings['2'] = sigc::bind(sigc::mem_fun(this, &Download::receive_min_uploads), 1);
m_bindings['3'] = sigc::bind(sigc::mem_fun(this, &Download::receive_max_uploads), -1);
m_bindings['4'] = sigc::bind(sigc::mem_fun(this, &Download::receive_max_uploads), 1);
m_bindings['!'] = sigc::bind(sigc::mem_fun(this, &Download::receive_min_downloads), -1);
m_bindings['@'] = sigc::bind(sigc::mem_fun(this, &Download::receive_min_downloads), 1);
m_bindings['#'] = sigc::bind(sigc::mem_fun(this, &Download::receive_max_downloads), -1);
m_bindings['$'] = sigc::bind(sigc::mem_fun(this, &Download::receive_max_downloads), 1);
m_bindings['5'] = sigc::bind(sigc::mem_fun(this, &Download::receive_min_peers), -5);
m_bindings['6'] = sigc::bind(sigc::mem_fun(this, &Download::receive_min_peers), 5);
m_bindings['7'] = sigc::bind(sigc::mem_fun(this, &Download::receive_max_peers), -5);
m_bindings['8'] = sigc::bind(sigc::mem_fun(this, &Download::receive_max_peers), 5);
m_bindings['+'] = sigc::mem_fun(this, &Download::receive_next_priority);
m_bindings['-'] = sigc::mem_fun(this, &Download::receive_prev_priority);
+3
View File
@@ -99,7 +99,10 @@ private:
inline ElementBase* create_menu();
inline ElementBase* create_info();
void receive_min_uploads(int t);
void receive_max_uploads(int t);
void receive_min_downloads(int t);
void receive_max_downloads(int t);
void receive_min_peers(int t);
void receive_max_peers(int t);