* Added framework for introducing different choking algorithms.

git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1196 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2011-03-30 10:39:03 +00:00
parent 143de32dc4
commit 9ed7596daf
5 changed files with 76 additions and 14 deletions
+6 -1
View File
@@ -397,7 +397,12 @@ DownloadFactory::initialize_rtorrent(Download* download, torrent::Object* rtorre
rtorrent->insert_preserve_copy("views", torrent::Object::create_list());
rtorrent->insert_preserve_type("connection_leech", m_variables["connection_leech"]);
rtorrent->insert_preserve_type("connection_seed", m_variables["connection_seed"]);
rtorrent->insert_preserve_type("connection_seed", m_variables["connection_seed"]);
rtorrent->insert_preserve_copy("choke_heuristics.up.leech", rpc::call_command_void("protocol.choke_heuristics.up.leech"));
rtorrent->insert_preserve_copy("choke_heuristics.up.seed", rpc::call_command_void("protocol.choke_heuristics.up.seed"));
rtorrent->insert_preserve_copy("choke_heuristics.down.leech", rpc::call_command_void("protocol.choke_heuristics.down.leech"));
rtorrent->insert_preserve_copy("choke_heuristics.down.seed", rpc::call_command_void("protocol.choke_heuristics.down.seed"));
}
}
+11 -3
View File
@@ -357,9 +357,14 @@ DownloadList::resume(Download* download, int flags) {
rpc::call_command("d.state_counter.set", rpc::call_command_value("d.state_counter", rpc::make_target(download)) + 1, rpc::make_target(download));
if (download->is_done()) {
rpc::call_command("d.connection_current.set", rpc::call_command_void("d.connection_seed", rpc::make_target(download)), rpc::make_target(download));
rpc::call_command("d.connection_current.set", rpc::call_command_void("d.connection_seed", rpc::make_target(download)), rpc::make_target(download));
rpc::call_command("d.up.choke_heuristics.set", rpc::call_command_void("d.up.choke_heuristics.seed", rpc::make_target(download)), rpc::make_target(download));
rpc::call_command("d.down.choke_heuristics.set", rpc::call_command_void("d.down.choke_heuristics.seed", rpc::make_target(download)), rpc::make_target(download));
} else {
rpc::call_command("d.connection_current.set", rpc::call_command_void("d.connection_leech", rpc::make_target(download)), rpc::make_target(download));
rpc::call_command("d.connection_current.set", rpc::call_command_void("d.connection_leech", rpc::make_target(download)), rpc::make_target(download));
rpc::call_command("d.up.choke_heuristics.set", rpc::call_command_void("d.up.choke_heuristics.leech", rpc::make_target(download)), rpc::make_target(download));
rpc::call_command("d.down.choke_heuristics.set", rpc::call_command_void("d.down.choke_heuristics.leech", rpc::make_target(download)), rpc::make_target(download));
// For the moment, clear the resume data so we force hash-check
// on non-complete downloads after a crash. This shouldn't be
@@ -576,7 +581,10 @@ DownloadList::confirm_finished(Download* download) {
rpc::call_command("d.complete.set", (int64_t)1, rpc::make_target(download));
rpc::call_command("d.connection_current.set", rpc::call_command_void("d.connection_seed", rpc::make_target(download)), rpc::make_target(download));
rpc::call_command("d.connection_current.set", rpc::call_command_void("d.connection_seed", rpc::make_target(download)), rpc::make_target(download));
rpc::call_command("d.up.choke_heuristics.set", rpc::call_command_void("d.up.choke_heuristics.seed", rpc::make_target(download)), rpc::make_target(download));
rpc::call_command("d.down.choke_heuristics.set", rpc::call_command_void("d.down.choke_heuristics.seed", rpc::make_target(download)), rpc::make_target(download));
download->set_priority(download->priority());
if (rpc::call_command_value("d.peers_min", rpc::make_target(download)) == rpc::call_command_value("throttle.min_peers.normal") &&