* Added interface for changing download priority.

* More throttle fiddling.

* Pop the currently uploaded piece from the send list.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@591 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2005-11-01 19:42:07 +00:00
parent 1a68177eca
commit 89e69adb7a
4 changed files with 22 additions and 15 deletions
+6 -2
View File
@@ -52,10 +52,13 @@ Download::Download() :
void void
Download::start() { Download::start() {
if (is_done()) if (is_done()) {
m_download.set_connection_type(m_connectionSeed); m_download.set_connection_type(m_connectionSeed);
else torrent::download_set_priority(m_download, 2);
} else {
m_download.set_connection_type(m_connectionLeech); m_download.set_connection_type(m_connectionLeech);
torrent::download_set_priority(m_download, 4);
}
m_download.start(); m_download.start();
} }
@@ -98,6 +101,7 @@ Download::release_download() {
void void
Download::receive_finished() { Download::receive_finished() {
m_download.set_connection_type(m_connectionSeed); m_download.set_connection_type(m_connectionSeed);
torrent::download_set_priority(m_download, 2);
} }
void void
+3 -2
View File
@@ -41,6 +41,7 @@
#include <netinet/in.h> #include <netinet/in.h>
#include "core/manager.h" #include "core/manager.h"
#include "ui/root.h"
#include "utils/directory.h" #include "utils/directory.h"
#include "control.h" #include "control.h"
@@ -146,12 +147,12 @@ apply_connection_seed(Control* m, const std::string& arg) {
void void
apply_global_download_rate(Control* m, int arg) { apply_global_download_rate(Control* m, int arg) {
torrent::set_down_throttle(arg * 1024); m->ui()->receive_down_throttle(arg);
} }
void void
apply_global_upload_rate(Control* m, int arg) { apply_global_upload_rate(Control* m, int arg) {
torrent::set_up_throttle(arg * 1024); m->ui()->receive_up_throttle(arg);
} }
void void
+10 -8
View File
@@ -114,27 +114,29 @@ Root::setup_keys() {
void void
Root::receive_down_throttle(int t) { Root::receive_down_throttle(int t) {
m_windowStatusbar->mark_dirty(); if (m_windowStatusbar != NULL)
m_windowStatusbar->mark_dirty();
torrent::set_down_throttle(std::max<int>(torrent::get_down_throttle() + t * 1024, 0)); torrent::set_down_throttle(std::max<int>(torrent::get_down_throttle() + t * 1024, 0));
} }
void void
Root::receive_up_throttle(int t) { Root::receive_up_throttle(int t) {
m_windowStatusbar->mark_dirty(); if (m_windowStatusbar != NULL)
m_windowStatusbar->mark_dirty();
uint32_t throttle = std::max<int>(torrent::get_up_throttle() + t * 1024, 0); uint32_t throttle = std::max<int>(torrent::get_up_throttle() + t * 1024, 0);
torrent::set_up_throttle(throttle); torrent::set_up_throttle(throttle);
// if (throttle == 0) if (throttle == 0)
// torrent::set_max_unchoked(0); torrent::set_max_unchoked(0);
// else if (throttle <= 10 << 10) else if (throttle <= 10 << 10)
// torrent::set_max_unchoked(1 + throttle / (1 << 10)); torrent::set_max_unchoked(1 + throttle / (1 << 10));
// else else
// torrent::set_max_unchoked(10 + throttle / (5 << 10)); torrent::set_max_unchoked(10 + throttle / (5 << 10));
} }
} }
+3 -3
View File
@@ -60,12 +60,12 @@ public:
WStatusbar* window_statusbar() { return m_windowStatusbar; } WStatusbar* window_statusbar() { return m_windowStatusbar; }
private:
void setup_keys();
void receive_down_throttle(int t); void receive_down_throttle(int t);
void receive_up_throttle(int t); void receive_up_throttle(int t);
private:
void setup_keys();
Control* m_control; Control* m_control;
DownloadList* m_downloadList; DownloadList* m_downloadList;