* Added Peer Exchange support, enable with the "peer_exchange"

option. Patch by Josef Drexler, public domain as per earlier
agreement.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@968 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2007-08-30 20:35:23 +00:00
parent 73c41074ec
commit 332b4a303f
7 changed files with 20 additions and 1 deletions
+7
View File
@@ -483,6 +483,13 @@ between plaintext transmission and RC4 encryption, otherwise RC4 will be used).
</para></listitem>
</varlistentry>
<varlistentry>
<term>peer_exchange = <replaceable>yes | no</replaceable></term>
<listitem><para>
Enable/disable peer exchange for torrents that aren't marked private. Disabled by default.
</para></listitem>
</varlistentry>
<varlistentry>
<term>schedule = <replaceable>id</replaceable>,<replaceable>start</replaceable>,<replaceable>interval</replaceable>,<replaceable>command</replaceable></term>
<listitem><para>
+4
View File
@@ -74,6 +74,10 @@
#
# encryption = allow_incoming,enable_retry,prefer_plaintext
# Enable peer exchange (for torrents not marked private)
#
# peer_exchange = yes
#
# Do not modify the following parameters unless you know what you're doing.
#
+3
View File
@@ -447,6 +447,9 @@ initialize_command_download() {
ADD_CD_VALUE_UNI("peers_complete", rak::on(std::mem_fun(&core::Download::download), std::mem_fun(&torrent::Download::peers_complete)));
ADD_CD_VALUE_UNI("peers_accounted", rak::on(std::mem_fun(&core::Download::download), std::mem_fun(&torrent::Download::peers_accounted)));
ADD_CD_VALUE_MEM_BI("peer_exchange", &core::Download::download, &torrent::Download::set_pex_enabled, &torrent::Download::pex_enabled);
ADD_CD_VALUE_UNI("private", rak::on(std::mem_fun(&core::Download::download), std::mem_fun(&torrent::Download::is_private)));
ADD_CD_VALUE_MEM_UNI("up_rate", &torrent::Download::mutable_up_rate, &torrent::Rate::rate);
ADD_CD_VALUE_MEM_UNI("up_total", &torrent::Download::mutable_up_rate, &torrent::Rate::total);
ADD_CD_VALUE_MEM_UNI("down_rate", &torrent::Download::mutable_down_rate, &torrent::Rate::rate);
+1 -1
View File
@@ -53,7 +53,7 @@ namespace rpc {
// heap. This should reduce memory use and improve cache locality.
#define COMMAND_SLOTS_SIZE 150
#define COMMAND_VARIABLES_SIZE 100
#define COMMAND_DOWNLOAD_SLOTS_SIZE 100
#define COMMAND_DOWNLOAD_SLOTS_SIZE 150
#define COMMAND_FILE_SLOTS_SIZE 20
#define COMMAND_FILE_ITR_SLOTS_SIZE 10
#define COMMAND_PEER_SLOTS_SIZE 20
+2
View File
@@ -320,6 +320,8 @@ initialize_command_network() {
ADD_COMMAND_VALUE_UN("enable_trackers", std::ptr_fun(&apply_enable_trackers));
ADD_COMMAND_STRING_UN("encoding_list", std::ptr_fun(&apply_encoding_list));
ADD_VARIABLE_BOOL("peer_exchange", false);
// Not really network stuff:
ADD_VARIABLE_BOOL("handshake_log", false);
ADD_VARIABLE_STRING("tracker_dump", "");
+2
View File
@@ -230,6 +230,8 @@ DownloadFactory::receive_success() {
if (!m_session && m_variables["tied_to_file"].as_value())
rpc::call_command("d.set_tied_to_file", m_uri, rpc::make_target(download));
rpc::call_command("d.set_peer_exchange", rpc::call_command_value("get_peer_exchange"), rpc::make_target(download));
torrent::Object& resumeObject = root->has_key_map("libtorrent_resume")
? root->get_key("libtorrent_resume")
: root->insert_key("libtorrent_resume", torrent::Object(torrent::Object::TYPE_MAP));
+1
View File
@@ -162,6 +162,7 @@ Download::create_info() {
element->push_back("");
element->push_column("Chunks:", te_variable_value("d.get_completed_chunks"), " / ", te_variable_value("d.get_size_chunks"), " * ", te_variable_value("d.get_chunk_size"));
element->push_column("Priority:", te_variable_value("d.get_priority"));
element->push_column("Peer exchange:", display::text_element_branch(std::mem_fun(&torrent::Download::pex_enabled), te_string("enabled"), te_string("disabled")));
element->push_column("State changed:", te_variable_value("d.get_state_changed", value_base::flag_timer | value_base::flag_elapsed));