mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-15 22:52:31 +00:00
* 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:
@@ -52,10 +52,13 @@ Download::Download() :
|
||||
|
||||
void
|
||||
Download::start() {
|
||||
if (is_done())
|
||||
if (is_done()) {
|
||||
m_download.set_connection_type(m_connectionSeed);
|
||||
else
|
||||
torrent::download_set_priority(m_download, 2);
|
||||
} else {
|
||||
m_download.set_connection_type(m_connectionLeech);
|
||||
torrent::download_set_priority(m_download, 4);
|
||||
}
|
||||
|
||||
m_download.start();
|
||||
}
|
||||
@@ -98,6 +101,7 @@ Download::release_download() {
|
||||
void
|
||||
Download::receive_finished() {
|
||||
m_download.set_connection_type(m_connectionSeed);
|
||||
torrent::download_set_priority(m_download, 2);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
@@ -41,6 +41,7 @@
|
||||
#include <netinet/in.h>
|
||||
|
||||
#include "core/manager.h"
|
||||
#include "ui/root.h"
|
||||
#include "utils/directory.h"
|
||||
|
||||
#include "control.h"
|
||||
@@ -146,12 +147,12 @@ apply_connection_seed(Control* m, const std::string& arg) {
|
||||
|
||||
void
|
||||
apply_global_download_rate(Control* m, int arg) {
|
||||
torrent::set_down_throttle(arg * 1024);
|
||||
m->ui()->receive_down_throttle(arg);
|
||||
}
|
||||
|
||||
void
|
||||
apply_global_upload_rate(Control* m, int arg) {
|
||||
torrent::set_up_throttle(arg * 1024);
|
||||
m->ui()->receive_up_throttle(arg);
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
+10
-8
@@ -114,27 +114,29 @@ Root::setup_keys() {
|
||||
|
||||
void
|
||||
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));
|
||||
}
|
||||
|
||||
void
|
||||
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);
|
||||
|
||||
torrent::set_up_throttle(throttle);
|
||||
|
||||
// if (throttle == 0)
|
||||
// torrent::set_max_unchoked(0);
|
||||
if (throttle == 0)
|
||||
torrent::set_max_unchoked(0);
|
||||
|
||||
// else if (throttle <= 10 << 10)
|
||||
// torrent::set_max_unchoked(1 + throttle / (1 << 10));
|
||||
else if (throttle <= 10 << 10)
|
||||
torrent::set_max_unchoked(1 + throttle / (1 << 10));
|
||||
|
||||
// else
|
||||
// torrent::set_max_unchoked(10 + throttle / (5 << 10));
|
||||
else
|
||||
torrent::set_max_unchoked(10 + throttle / (5 << 10));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+3
-3
@@ -60,12 +60,12 @@ public:
|
||||
|
||||
WStatusbar* window_statusbar() { return m_windowStatusbar; }
|
||||
|
||||
private:
|
||||
void setup_keys();
|
||||
|
||||
void receive_down_throttle(int t);
|
||||
void receive_up_throttle(int t);
|
||||
|
||||
private:
|
||||
void setup_keys();
|
||||
|
||||
Control* m_control;
|
||||
DownloadList* m_downloadList;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user