From 29ef815d0ee0e5c5fe9ea20c05c4ec99986fdba8 Mon Sep 17 00:00:00 2001 From: rakshasa Date: Wed, 11 Oct 2006 11:46:33 +0000 Subject: [PATCH] * 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 --- doc/rtorrent.1 | 58 ++++++++++++++++++++++-------------- doc/rtorrent.1.xml | 8 +++++ src/core/download.cc | 8 +++++ src/core/download_factory.cc | 1 + src/option_handler_rules.cc | 2 ++ src/ui/download.cc | 4 +++ src/utils/variable_generic.h | 11 +++++++ 7 files changed, 69 insertions(+), 23 deletions(-) diff --git a/doc/rtorrent.1 b/doc/rtorrent.1 index d57fe22e..e3023dd9 100644 --- a/doc/rtorrent.1 +++ b/doc/rtorrent.1 @@ -3,7 +3,7 @@ .\" .\" Please send any bug reports, improvements, comments, patches, .\" etc. to Steve Cheng . -.TH "RTORRENT" "1" "15 August 2006" "BitTorrent client for ncurses" "" +.TH "RTORRENT" "1" "11 October 2006" "BitTorrent client for ncurses" "" .SH NAME rtorrent \- a BitTorrent client for ncurses @@ -13,11 +13,14 @@ rtorrent \- a BitTorrent client for ncurses .SH "DESCRIPTION" .PP -\fBrtorrent\fR is a BitTorrent client for ncurses, -using the \fBlibtorrent\fR library. The client -and library is written in C++ with emphasis on speed and -efficiency, while delivering equivalent features to those found -in GUI based clients in an ncurses client. +\fBrtorrent\fR is a BitTorrent client for ncurses, using +the \fBlibtorrent\fR library. The client and library is +written in C++ with emphasis on speed and efficiency, while delivering +equivalent features to those found in GUI based clients in an ncurses +client. +.PP +Most of the options below have their own default unit in addition to +supporting B, K, M and G suffixes. .SH "KEYBOARD CONTROL" .PP .SS "GLOBAL KEYS" @@ -26,11 +29,12 @@ in GUI based clients in an ncurses client. Initiate shutdown, press again to force the shutdown and skip sending the stop signal to trackers. .TP -\fBup | down\fR -Select item. +\fBup | down | left | right arrow keys\fR .TP -\fB<-\fR -Go back to the previous screen. +\fB^P | ^N | ^B | ^F\fR +Select entries or change windows. The right arrow key or ^F is often +used for viewing details about the selected entry, while the left +arrow key or ^B often returns to the previous screen. .TP \fBa | s | d\fR Increase the upload throttle by 1/5/50 KB. @@ -64,8 +68,11 @@ Close a torrent and its files. Initiate hash check of torrent. .TP \fB^O\fR -Change the destination directory of the download. The -torrent must be closed. +Change the destination directory of the download. The torrent must be +closed. +.TP +\fB^X\fR +Call commands or change settings. .TP \fB+ | -\fR Change the priority of the download. @@ -78,9 +85,6 @@ auto-complete. \fBl\fR View log. Exit by pressing the space-bar. .TP -\fB^P\fR -Call commands or change settings. -.TP \fBU\fR Delete the file the torrent is tied to, and clear the association. .TP @@ -89,9 +93,8 @@ Toggle whether torrent ignores ratio settings. .SS "DOWNLOAD VIEW KEYS" .TP \fB->\fR -View torrent file list. Use the space-bar to change the -file priority and \fB*\fR to change the -priority of all files. +View torrent file list. Use the space-bar to change the file priority +and \fB*\fR to change the priority of all files. .TP \fB1 | 2\fR Adjust max uploads. @@ -109,8 +112,8 @@ Display transfering blocks. Display chunk rarity. .TP \fBo\fR -Display the tracker list. Cycle the trackers in a group -with the space-bar. +Display the tracker list. Cycle the trackers in a group with the +space-bar. .TP \fBp\fR View peer and torrent information. @@ -185,6 +188,10 @@ Set the maximum global download rate. \fBupload_rate = \fIKB\fB\fR Set the maximum global upload rate. .TP +\fBtracker_numwant = \fInumber\fB\fR +Set the numwant field sent to the tracker, which indicates how many +peers we want. A negative value disables this feature. +.TP \fBbind = \fIa.b.c.d\fB\fR Bind listening socket and outgoing connections to this network interface address. @@ -250,7 +257,7 @@ have been deleted. Clear the association with the 'U' key. \fBclose_low_diskspace = \fIspace\fB\fR Close any active torrents on filesystems with less than \fBspace\fR diskspace left. Use with -\fBschedule\fR\&. +the \fBschedule\fR option. .TP \fBstop_on_ratio = \fImin_ratio\fB\fR .TP @@ -261,11 +268,11 @@ Stop torrents when they reach the given upload ratio \fBmin_ratio\fR in percent. If the optional \fBmin_upload\fR is given, require a total upload amount of this many bytes as well. If the optional -\fBmax_ratio>\fR is given, stop the torrent +\fBmax_ratio\fR is given, stop the torrent when reaching this ratio regardless of the total upload amount. Exclude certain torrent by pressing \fBShift+I\fR in the downlist list. -Use with \fBschedule\fR\&. +Use with the \fBschedule\fR option. .TP \fBload = \fIfile\fB\fR .TP @@ -356,6 +363,11 @@ Number of sockets to simultaneously keep open. This value is set to be \fBsysconf(_SC_OPEN_MAX) - 256\fR at startup. This gives the client 128 sockets to use as it wishes. .TP +\fBmax_memory_usage = \fIbytes\fB\fR +Set the max amount of memory space used to mapping file chunks. This +may also be set using \fBulimit -m\fR where 3/4 will be +allocated to file chunks. +.TP \fBsend_buffer_size = \fIvalue\fB\fR .TP \fBreceive_buffer_size = \fIvalue\fB\fR diff --git a/doc/rtorrent.1.xml b/doc/rtorrent.1.xml index e1e4032c..7fc580c4 100644 --- a/doc/rtorrent.1.xml +++ b/doc/rtorrent.1.xml @@ -438,6 +438,14 @@ Set the maximum global upload rate. + + tracker_numwant = number + +Set the numwant field sent to the tracker, which indicates how many +peers we want. A negative value disables this feature. + + + bind = a.b.c.d diff --git a/src/core/download.cc b/src/core/download.cc index 8ea1f8be..852f4516 100644 --- a/src/core/download.cc +++ b/src/core/download.cc @@ -42,6 +42,7 @@ #include #include #include +#include #include #include #include @@ -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)); } diff --git a/src/core/download_factory.cc b/src/core/download_factory.cc index 6b284ece..a09b4072 100644 --- a/src/core/download_factory.cc +++ b/src/core/download_factory.cc @@ -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) diff --git a/src/option_handler_rules.cc b/src/option_handler_rules.cc index abb36354..6cbc84d4 100644 --- a/src/option_handler_rules.cc +++ b/src/option_handler_rules.cc @@ -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))); diff --git a/src/ui/download.cc b/src/ui/download.cc index d443c48e..24e76eb5 100644 --- a/src/ui/download.cc +++ b/src/ui/download.cc @@ -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; diff --git a/src/utils/variable_generic.h b/src/utils/variable_generic.h index b755a656..d2f78df2 100644 --- a/src/utils/variable_generic.h +++ b/src/utils/variable_generic.h @@ -139,6 +139,17 @@ public: m_slotSet.set(rak::convert_fn(slotSet)); } + template + VariableValueSlot(SlotGet* slotGet, void* slotSet, unsigned int base = 0, unsigned int unit = 1, + range_type range = range_type(std::numeric_limits::min(), std::numeric_limits::max())) : + m_base(base), + m_unit(unit), + m_range(range) { + + m_slotGet.set(rak::convert_fn(slotGet)); + m_slotSet.set(NULL); + } + virtual const torrent::Object& get(); virtual void set(const torrent::Object& arg);