* Moved some stuff from Content into FileList.

* Resume data was not being used as it was comparing the number of
entries with size_bytes, not size_files.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@812 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2006-11-30 15:14:26 +00:00
parent 8b759a5c6e
commit c992fa60df
5 changed files with 22 additions and 10 deletions
+4
View File
@@ -98,6 +98,10 @@ Download::Download(download_type d) :
m_variables.insert("max_peers", new utils::VariableValueSlot(rak::mem_fn(&m_download, &download_type::peers_max), rak::mem_fn(&m_download, &download_type::set_peers_max)));
m_variables.insert("max_uploads", new utils::VariableValueSlot(rak::mem_fn(&m_download, &download_type::uploads_max), rak::mem_fn(&m_download, &download_type::set_uploads_max)));
m_variables.insert("max_file_size", new utils::VariableValueSlot(rak::mem_fn(file_list(), &file_list_type::max_file_size), rak::mem_fn(file_list(), &file_list_type::set_max_file_size)));
// m_variables.insert("split_file_size", new utils::VariableValueSlot(rak::mem_fn(file_list(), &file_list_type::split_file_size), rak::mem_fn(file_list(), &file_list_type::set_split_file_size)));
// m_variables.insert("split_suffix", new utils::VariableStringSlot(rak::mem_fn(file_list(), &file_list_type::split_suffix), rak::mem_fn(file_list(), &file_list_type::set_split_suffix)));
m_variables.insert("up_rate", new utils::VariableValueSlot(rak::mem_fn(m_download.up_rate(), &torrent::Rate::rate), NULL));
m_variables.insert("up_total", new utils::VariableValueSlot(rak::mem_fn(m_download.up_rate(), &torrent::Rate::total), NULL));
m_variables.insert("down_rate", new utils::VariableValueSlot(rak::mem_fn(m_download.down_rate(), &torrent::Rate::rate), NULL));
+3 -2
View File
@@ -51,6 +51,7 @@ namespace core {
class Download {
public:
typedef torrent::Download download_type;
typedef torrent::FileList file_list_type;
typedef torrent::TrackerList tracker_list_type;
typedef download_type::ConnectionType connection_type;
typedef utils::VariableMap variable_map_type;
@@ -85,8 +86,8 @@ public:
download_type* download() { return &m_download; }
const download_type* c_download() const { return &m_download; }
torrent::FileList* file_list() { return m_download.file_list(); }
const torrent::FileList* c_file_list() const { return m_download.file_list(); }
file_list_type* file_list() { return m_download.file_list(); }
const file_list_type* c_file_list() const { return m_download.file_list(); }
torrent::Object* bencode() { return m_download.bencode(); }
tracker_list_type* tracker_list() { return &m_trackerList; }
+9
View File
@@ -190,6 +190,15 @@ DownloadFactory::receive_success() {
if (!control->variable()->get_value("use_udp_trackers"))
download->enable_udp_trackers(false);
if (control->variable()->get_value("max_file_size") > 0)
download->variable()->set("max_file_size", control->variable()->get("max_file_size"));
// if (control->variable()->get_value("split_file_size") >= 0)
// download->variable()->set("split_file_size", control->variable()->get("split_file_size"));
// if (!control->variable()->get_string("split_suffix").empty())
// download->variable()->set("split_suffix", control->variable()->get("split_suffix"));
if (!rtorrent->has_key_string("directory"))
download->variable()->set("directory", m_variables.get("directory"));
else
+4
View File
@@ -519,6 +519,10 @@ initialize_option_handler(Control* c) {
rak::mem_fn(torrent::chunk_manager(), &torrent::ChunkManager::set_preload_required_rate),
0, (1 << 10)));
variables->insert("max_file_size", new utils::VariableValue(-1));
variables->insert("split_file_size", new utils::VariableValue(-1));
variables->insert("split_suffix", new utils::VariableAny(""));
variables->insert("port_range", new utils::VariableStringSlot(rak::value_fn(std::string()), rak::bind_ptr_fn(&apply_port_range, c)));
variables->insert("hash_read_ahead", new utils::VariableValueSlot(rak::ptr_fn(torrent::hash_read_ahead), rak::bind_ptr_fn(&apply_hash_read_ahead, c)));
+2 -8
View File
@@ -54,9 +54,7 @@ VariableAny::set(const torrent::Object& arg) {
void
VariableValue::set(const torrent::Object& arg) {
uint64_t value;
const char* first;
char* last;
int64_t value;
switch (arg.type()) {
case torrent::Object::TYPE_NONE:
@@ -68,11 +66,7 @@ VariableValue::set(const torrent::Object& arg) {
break;
case torrent::Object::TYPE_STRING:
first = arg.as_string().c_str();
value = strtoll(first, &last, 0);
if (last == first || *last != '\0')
throw torrent::input_error("Could not convert string to value.");
string_to_value_unit(arg.as_string().c_str(), &value, 0, 1);
m_variable = value;
break;