* Added "tracker_numwant" option for setting the numwant field sent to

the tracker.

* Added display for the up/down rate total in download info.

* Use completed bytes from Content for download progress reported to
the tracker, rather than download rate total.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@786 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2006-10-11 11:46:33 +00:00
parent 8f311cda47
commit 29ef815d0e
7 changed files with 69 additions and 23 deletions
+8
View File
@@ -42,6 +42,7 @@
#include <sigc++/signal.h>
#include <rak/path.h>
#include <torrent/exceptions.h>
#include <torrent/rate.h>
#include <torrent/torrent.h>
#include <torrent/tracker.h>
#include <torrent/tracker_list.h>
@@ -97,8 +98,15 @@ Download::Download(download_type d) :
m_variables.insert("max_peers", new utils::VariableValueSlot(rak::mem_fn(&m_download, &download_type::peers_max), rak::mem_fn(&m_download, &download_type::set_peers_max)));
m_variables.insert("max_uploads", new utils::VariableValueSlot(rak::mem_fn(&m_download, &download_type::uploads_max), rak::mem_fn(&m_download, &download_type::set_uploads_max)));
m_variables.insert("up_rate", new utils::VariableValueSlot(rak::mem_fn(m_download.up_rate(), &torrent::Rate::rate), NULL));
m_variables.insert("up_total", new utils::VariableValueSlot(rak::mem_fn(m_download.up_rate(), &torrent::Rate::total), NULL));
m_variables.insert("down_rate", new utils::VariableValueSlot(rak::mem_fn(m_download.down_rate(), &torrent::Rate::rate), NULL));
m_variables.insert("down_total", new utils::VariableValueSlot(rak::mem_fn(m_download.down_rate(), &torrent::Rate::total), NULL));
m_variables.insert("priority", new utils::VariableValueSlot(rak::mem_fn(this, &Download::priority), rak::mem_fn(this, &Download::set_priority)));
m_variables.insert("tracker_numwant", new utils::VariableValueSlot(rak::mem_fn(&m_trackerList, &tracker_list_type::numwant), rak::mem_fn(&m_trackerList, &tracker_list_type::set_numwant)));
m_variables.insert("ignore_commands", new utils::VariableObject(bencode(), "rtorrent", "ignore_commands", torrent::Object::TYPE_VALUE));
}
+1
View File
@@ -176,6 +176,7 @@ DownloadFactory::receive_success() {
download->variable()->set("max_uploads", control->variable()->get("max_uploads"));
download->variable()->set("min_peers", control->variable()->get("min_peers"));
download->variable()->set("max_peers", control->variable()->get("max_peers"));
download->variable()->set("tracker_numwant", control->variable()->get("tracker_numwant"));
if (download->variable()->get_value("complete") != 0) {
if (control->variable()->get_value("min_peers_seed") >= 0)
+2
View File
@@ -435,6 +435,8 @@ initialize_option_handler(Control* c) {
variables->insert("upload_rate", new utils::VariableValueSlot(rak::ptr_fn(&torrent::up_throttle), rak::mem_fn(control->ui(), &ui::Root::set_up_throttle_i64),
0, (1 << 10)));
variables->insert("tracker_numwant", new utils::VariableValue(-1));
variables->insert("hash_max_tries", new utils::VariableValueSlot(rak::ptr_fn(&torrent::hash_max_tries), rak::ptr_fn(&torrent::set_hash_max_tries)));
variables->insert("max_open_files", new utils::VariableValueSlot(rak::ptr_fn(&torrent::max_open_files), rak::ptr_fn(&torrent::set_max_open_files)));
variables->insert("max_open_sockets", new utils::VariableValueSlot(rak::ptr_fn(&torrent::max_open_sockets), rak::ptr_fn(&torrent::set_max_open_sockets)));
+4
View File
@@ -172,6 +172,10 @@ Download::create_info() {
element->push_column("Send buffer:", te_value(&torrent::ConnectionManager::send_buffer_size, value_base::flag_kb), " KB");
element->push_column("Receive buffer:", te_value(&torrent::ConnectionManager::receive_buffer_size, value_base::flag_kb), " KB");
element->push_back("");
element->push_column("Upload:", te_variable_value("up_rate", value_base::flag_kb), " KB / ", te_variable_value("down_total", value_base::flag_xb));
element->push_column("Download:", te_variable_value("down_rate", value_base::flag_kb), " KB / ", te_variable_value("down_total", value_base::flag_xb));
element->set_column_width(element->column_width() + 1);
return element;
+11
View File
@@ -139,6 +139,17 @@ public:
m_slotSet.set(rak::convert_fn<void, value_type>(slotSet));
}
template <typename SlotGet>
VariableValueSlot(SlotGet* slotGet, void* slotSet, unsigned int base = 0, unsigned int unit = 1,
range_type range = range_type(std::numeric_limits<value_type>::min(), std::numeric_limits<value_type>::max())) :
m_base(base),
m_unit(unit),
m_range(range) {
m_slotGet.set(rak::convert_fn<value_type>(slotGet));
m_slotSet.set(NULL);
}
virtual const torrent::Object& get();
virtual void set(const torrent::Object& arg);