* Include locally available chunks in the "chunks seen" statistics for completed/distributed copies. Patch by Josef Drexler.

* Added 'd.get_bitfield' command for retrieving the bitfield in hex format. Patch by Thomas Rosner. (PD)

* Fixed include headers for gcc-4.4.0. Patch by 'kloeri'.

* Switched a 'long long' with 'int64_t' in xmlrpc.cc to avoid incompatible types for some systems.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1092 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2009-05-14 13:07:47 +00:00
parent 855bf9a781
commit 63af7078a3
13 changed files with 54 additions and 16 deletions
+19 -1
View File
@@ -3,7 +3,7 @@
.\" <http://shell.ipoline.com/~elmert/comp/docbook2X/> .\" <http://shell.ipoline.com/~elmert/comp/docbook2X/>
.\" Please send any bug reports, improvements, comments, patches, .\" Please send any bug reports, improvements, comments, patches,
.\" etc. to Steve Cheng <steve@ggi-project.org>. .\" etc. to Steve Cheng <steve@ggi-project.org>.
.TH "RTORRENT" "1" "07 May 2008" "BitTorrent client for ncurses" "" .TH "RTORRENT" "1" "14 May 2009" "BitTorrent client for ncurses" ""
.SH NAME .SH NAME
rtorrent \- a BitTorrent client for ncurses rtorrent \- a BitTorrent client for ncurses
@@ -349,6 +349,24 @@ setting \fB0\fR\&.
\fBmax_downloads_global = \fIvalue\fB\fR \fBmax_downloads_global = \fIvalue\fB\fR
Max upload and download slots allowed. Disable by Max upload and download slots allowed. Disable by
setting \fB0\fR\&. setting \fB0\fR\&.
.TP
\fBthrottle_up = \fIname\fB, \fIupload_rate\fB\fR
.TP
\fBthrottle_down = \fIname\fB, \fIdownload_rate\fB\fR
Define secondary throttle and/or set the given upload or download rate. Attach to a download with the d.set_throttle_name=name command
or switch throttles with Ctrl-T. Download must be stopped when changing throttles. Note that secondary throttles only work if the
global upload/download is throttled. Setting a download to use the \fBNULL\fR throttle makes the download unthrottled
even when there is a global throttle. Note that this special case bypasses the global throttle entirely, and as such its rate and
transfer amounts are not included in the global statistics.
.TP
\fBthrottle_ip = \fIname\fB, \fIhost\fB\fR
.TP
\fBthrottle_ip = \fIname\fB, \fInetwork/prefix\fB\fR
.TP
\fBthrottle_ip = \fIname\fB, \fIstart\fB, \fIend\fB\fR
Use the given secondary throttle for a host, CIDR network or IP range. All peers with a matching IP will use this throttle instead
of the global throttle or a custom download throttle. The name may be \fBNULL\fR to make these peers unthrottled, with
the same caveats as explained above.
.SH "TRACKER RELATED SETTINGS" .SH "TRACKER RELATED SETTINGS"
.PP .PP
Tracker related settings. Tracker related settings.
+8 -6
View File
@@ -9,12 +9,12 @@ SUBDIRS = \
bin_PROGRAMS = rtorrent bin_PROGRAMS = rtorrent
rtorrent_LDADD = \ rtorrent_LDADD = \
$(top_srcdir)/src/ui/libsub_ui.a \ ui/libsub_ui.a \
$(top_srcdir)/src/core/libsub_core.a \ core/libsub_core.a \
$(top_srcdir)/src/display/libsub_display.a \ display/libsub_display.a \
$(top_srcdir)/src/input/libsub_input.a \ input/libsub_input.a \
$(top_srcdir)/src/rpc/libsub_rpc.a \ rpc/libsub_rpc.a \
$(top_srcdir)/src/utils/libsub_utils.a utils/libsub_utils.a
rtorrent_SOURCES = \ rtorrent_SOURCES = \
command_download.cc \ command_download.cc \
@@ -39,3 +39,5 @@ rtorrent_SOURCES = \
option_parser.h \ option_parser.h \
signal_handler.cc \ signal_handler.cc \
signal_handler.h signal_handler.h
INCLUDES = -I$(srcdir) -I$(top_srcdir)
+9
View File
@@ -38,6 +38,7 @@
#include <functional> #include <functional>
#include <unistd.h> #include <unistd.h>
#include <cstdio>
#include <rak/file_stat.h> #include <rak/file_stat.h>
#include <rak/error_number.h> #include <rak/error_number.h>
#include <rak/path.h> #include <rak/path.h>
@@ -289,6 +290,13 @@ retrieve_d_custom_throw(core::Download* download, const std::string& key) {
} }
} }
torrent::Object
retrieve_d_bitfield(core::Download* download) {
const torrent::Bitfield* bitField = download->download()->file_list()->bitfield();
return torrent::Object(rak::transform_hex(bitField->begin(), bitField->end()));
}
// Just a helper function atm. // Just a helper function atm.
torrent::Object torrent::Object
cmd_d_initialize_logs(core::Download* download) { cmd_d_initialize_logs(core::Download* download) {
@@ -552,6 +560,7 @@ initialize_command_download() {
ADD_CD_VOID("hash", &retrieve_d_hash); ADD_CD_VOID("hash", &retrieve_d_hash);
ADD_CD_VOID("local_id", &retrieve_d_local_id); ADD_CD_VOID("local_id", &retrieve_d_local_id);
ADD_CD_VOID("local_id_html", &retrieve_d_local_id_html); ADD_CD_VOID("local_id_html", &retrieve_d_local_id_html);
ADD_CD_VOID("bitfield", &retrieve_d_bitfield);
ADD_CD_VOID("base_path", &retrieve_d_base_path); ADD_CD_VOID("base_path", &retrieve_d_base_path);
ADD_CD_VOID("base_filename", &retrieve_d_base_filename); ADD_CD_VOID("base_filename", &retrieve_d_base_filename);
ADD_CD_STRING_UNI("name", rak::on(std::mem_fun(&core::Download::download), std::mem_fun(&torrent::Download::name))); ADD_CD_STRING_UNI("name", rak::on(std::mem_fun(&core::Download::download), std::mem_fun(&torrent::Download::name)));
+1
View File
@@ -37,6 +37,7 @@
#include "config.h" #include "config.h"
#include <functional> #include <functional>
#include <cstdio>
#include <rak/file_stat.h> #include <rak/file_stat.h>
#include <rak/path.h> #include <rak/path.h>
#include <rak/string_manip.h> #include <rak/string_manip.h>
+1
View File
@@ -37,6 +37,7 @@
#include "config.h" #include "config.h"
#include <functional> #include <functional>
#include <cstdio>
#include <rak/address_info.h> #include <rak/address_info.h>
#include <rak/path.h> #include <rak/path.h>
#include <torrent/connection_manager.h> #include <torrent/connection_manager.h>
+8 -6
View File
@@ -131,7 +131,7 @@ Download::receive_storage_error(std::string msg) {
float float
Download::distributed_copies() const { Download::distributed_copies() const {
const uint8_t* avail = m_download.chunks_seen(); const uint8_t* avail = m_download.chunks_seen();
const uint8_t* end = avail + m_download.file_list()->size_chunks(); const torrent::Bitfield* bitfield = m_download.file_list()->bitfield();
if (avail == NULL) if (avail == NULL)
return 0; return 0;
@@ -139,15 +139,17 @@ Download::distributed_copies() const {
int minAvail = std::numeric_limits<uint8_t>::max(); int minAvail = std::numeric_limits<uint8_t>::max();
int num = 0; int num = 0;
for (; avail < end; ++avail) for (uint32_t i = m_download.file_list()->size_chunks(); i-- > 0; ) {
if (*avail == minAvail) { int totAvail = (int)avail[i] + bitfield->get(i);
if (totAvail == minAvail) {
num++; num++;
} else if (*avail < minAvail) { } else if (totAvail < minAvail) {
minAvail = *avail; minAvail = totAvail;
num = 1; num = 1;
} }
}
return minAvail + 1 - (float)num / m_download.file_list()->size_chunks(); return minAvail + 1 - bitfield->is_all_set() - (float)num / m_download.file_list()->size_chunks();
} }
void void
+1
View File
@@ -37,6 +37,7 @@
#include "config.h" #include "config.h"
#include <cstring> #include <cstring>
#include <cstdio>
#include <sstream> #include <sstream>
#include <iomanip> #include <iomanip>
#include <rak/socket_address.h> #include <rak/socket_address.h>
+1
View File
@@ -38,6 +38,7 @@
#define RTORRENT_DISPLAY_UTILS_H #define RTORRENT_DISPLAY_UTILS_H
#include <ctime> #include <ctime>
#include <cstdio>
#include <string> #include <string>
namespace core { namespace core {
+1 -1
View File
@@ -67,7 +67,7 @@ WindowDownloadChunksSeen::redraw() {
return; return;
m_canvas->print(2, 0, "Chunks seen: [C/A/D %i/%i/%.2f]", m_canvas->print(2, 0, "Chunks seen: [C/A/D %i/%i/%.2f]",
(int)m_download->download()->peers_complete(), (int)m_download->download()->peers_complete() + m_download->download()->file_list()->is_done(),
(int)m_download->download()->peers_accounted(), (int)m_download->download()->peers_accounted(),
std::floor(m_download->distributed_copies() * 100.0f) / 100.0f); std::floor(m_download->distributed_copies() * 100.0f) / 100.0f);
+1
View File
@@ -37,6 +37,7 @@
#include "config.h" #include "config.h"
#include <cstring> #include <cstring>
#include <cstdio>
#include <locale> #include <locale>
#include <rak/path.h> #include <rak/path.h>
#include <torrent/exceptions.h> #include <torrent/exceptions.h>
+1
View File
@@ -37,6 +37,7 @@
#include "config.h" #include "config.h"
#include <rak/error_number.h> #include <rak/error_number.h>
#include <cstdio>
#include <sys/types.h> #include <sys/types.h>
#include <sys/socket.h> #include <sys/socket.h>
#include <torrent/exceptions.h> #include <torrent/exceptions.h>
+2 -2
View File
@@ -98,7 +98,7 @@ xmlrpc_list_entry_to_value(xmlrpc_env* env, xmlrpc_value* src, int index) {
#ifdef XMLRPC_HAVE_I8 #ifdef XMLRPC_HAVE_I8
case XMLRPC_TYPE_I8: case XMLRPC_TYPE_I8:
long long v2; int64_t v2;
xmlrpc_read_i8(env, tmp, &v2); xmlrpc_read_i8(env, tmp, &v2);
xmlrpc_DECREF(tmp); xmlrpc_DECREF(tmp);
return v2; return v2;
@@ -244,7 +244,7 @@ xmlrpc_to_object(xmlrpc_env* env, xmlrpc_value* value, int callType, rpc::target
#ifdef XMLRPC_HAVE_I8 #ifdef XMLRPC_HAVE_I8
case XMLRPC_TYPE_I8: case XMLRPC_TYPE_I8:
long long v2; int64_t v2;
xmlrpc_read_i8(env, value, &v2); xmlrpc_read_i8(env, value, &v2);
return torrent::Object((int64_t)v2); return torrent::Object((int64_t)v2);
+1
View File
@@ -40,6 +40,7 @@
#include <cctype> #include <cctype>
#include <cerrno> #include <cerrno>
#include <cstring> #include <cstring>
#include <cstdio>
#include <sstream> #include <sstream>
#include <fcntl.h> #include <fcntl.h>
#include <signal.h> #include <signal.h>