mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-16 07:02:30 +00:00
* 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:
@@ -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>
|
||||
|
||||
@@ -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.
|
||||
#
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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", "");
|
||||
|
||||
@@ -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));
|
||||
|
||||
@@ -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));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user