mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-13 21:52:30 +00:00
* Cache the current ceiling in rak::partial_queue.
* Added "enable_trackers=yes|no" option that can turn on/off the use of trackers on all torrents. * Cleanup of the API, including a new TrackerList class. * When requesting from seeders, either continue a chunk another seeder started or try a new one. This means seeders don't end up downloading non-rare chunks. git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@658 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -48,6 +48,7 @@
|
||||
#include <torrent/connection_manager.h>
|
||||
#include <torrent/exceptions.h>
|
||||
#include <torrent/torrent.h>
|
||||
#include <torrent/tracker_list.h>
|
||||
|
||||
#include "core/download.h"
|
||||
#include "core/manager.h"
|
||||
@@ -153,6 +154,25 @@ apply_encoding_list(__UNUSED Control* m, const std::string& arg) {
|
||||
torrent::encoding_list()->push_back(arg);
|
||||
}
|
||||
|
||||
void
|
||||
apply_enable_trackers(Control* m, __UNUSED const std::string& arg) {
|
||||
bool state = (arg != "no");
|
||||
|
||||
for (core::Manager::DListItr itr = m->core()->download_list().begin(), last = m->core()->download_list().end(); itr != last; ++itr) {
|
||||
|
||||
torrent::TrackerList tl = (*itr)->get_download().tracker_list();
|
||||
|
||||
for (int i = 0, last = tl.size(); i < last; ++i)
|
||||
if (state)
|
||||
tl.get(i).enable();
|
||||
else
|
||||
tl.get(i).disable();
|
||||
|
||||
if (state && control->variables()->get_string("use_udp_trackers") == "no")
|
||||
(*itr)->enable_udp_trackers(false);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
initialize_option_handler(Control* c) {
|
||||
utils::VariableMap* variables = control->variables();
|
||||
@@ -212,6 +232,8 @@ initialize_option_handler(Control* c) {
|
||||
variables->insert("stop_untied", new utils::VariableSlotString<>(NULL, rak::bind_ptr_fn(&apply_stop_untied, c)));
|
||||
variables->insert("remove_untied", new utils::VariableSlotString<>(NULL, rak::bind_ptr_fn(&apply_remove_untied, c)));
|
||||
|
||||
variables->insert("enable_trackers", new utils::VariableSlotString<>(NULL, rak::bind_ptr_fn(&apply_enable_trackers, c)));
|
||||
|
||||
variables->insert("encoding_list", new utils::VariableSlotString<>(NULL, rak::bind_ptr_fn(&apply_encoding_list, c)));
|
||||
|
||||
variables->insert("http_proxy", new utils::VariableSlotString<>(NULL, rak::bind_ptr_fn(&apply_http_proxy, c)));
|
||||
|
||||
Reference in New Issue
Block a user