* Fixed the transitions between skipping and downloading pieces.

* Added Object::merge_recursive.

* Save and set the chunks done count for closed torrents.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@733 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2006-06-30 01:02:41 +00:00
parent 4b79a7c47f
commit 9f2f427e9d
4 changed files with 17 additions and 16 deletions
+6 -11
View File
@@ -68,7 +68,7 @@ Download::Download(download_type d) :
m_download.signal_chunk_failed(sigc::mem_fun(*this, &Download::receive_chunk_failed));
m_variables.insert("connection_current", new utils::VariableStringSlot(rak::mem_fn(this, &Download::connection_current),
rak::mem_fn(this, &Download::set_connection_current)));
rak::mem_fn(this, &Download::set_connection_current)));
m_variables.insert("connection_leech", new utils::VariableAny(connection_type_to_string(download_type::CONNECTION_LEECH)));
m_variables.insert("connection_seed", new utils::VariableAny(connection_type_to_string(download_type::CONNECTION_SEED)));
@@ -89,17 +89,12 @@ Download::Download(download_type d) :
// resume/pause.
m_variables.insert("state_changed", new utils::VariableObject(bencode(), "rtorrent", "state_changed", torrent::Object::TYPE_VALUE));
m_variables.insert("directory", new utils::VariableStringSlot(rak::mem_fn(&m_fileList, &torrent::FileList::root_dir),
rak::mem_fn(this, &Download::set_root_directory)));
m_variables.insert("directory", new utils::VariableStringSlot(rak::mem_fn(&m_fileList, &torrent::FileList::root_dir), rak::mem_fn(this, &Download::set_root_directory)));
m_variables.insert("min_peers", new utils::VariableValueSlot(rak::mem_fn(&m_download, &download_type::peers_min),
rak::mem_fn(&m_download, &download_type::set_peers_min)));
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("priority", new utils::VariableValueSlot(rak::mem_fn(this, &Download::priority),
rak::mem_fn(this, &Download::set_priority)));
m_variables.insert("min_peers", new utils::VariableValueSlot(rak::mem_fn(&m_download, &download_type::peers_min), rak::mem_fn(&m_download, &download_type::set_peers_min)));
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("priority", new utils::VariableValueSlot(rak::mem_fn(this, &Download::priority), rak::mem_fn(this, &Download::set_priority)));
m_variables.insert("ignore_ratio", new utils::VariableObject(bencode(), "rtorrent", "ignore_ratio", torrent::Object::TYPE_VALUE));
}
+3
View File
@@ -266,6 +266,9 @@ DownloadFactory::initialize_rtorrent(Download* download, torrent::Object* rtorre
if (rtorrent->has_key_value("total_uploaded"))
download->download()->up_rate()->set_total(rtorrent->get_key_value("total_uploaded"));
if (rtorrent->has_key_value("chunks_done"))
download->download()->set_chunks_done(std::min<uint32_t>(rtorrent->get_key_value("chunks_done"), download->download()->chunks_total()));
if (!rtorrent->has_key_value("ignore_ratio"))
rtorrent->insert_key("ignore_ratio", (int64_t)0);
}
+2 -1
View File
@@ -104,8 +104,9 @@ DownloadStore::save(Download* d) {
if (!f.is_open())
return;
// Move this somewhere else.
// Move this somewhere else?
d->bencode()->get_key("rtorrent").insert_key("total_uploaded", d->download()->up_rate()->total());
d->bencode()->get_key("rtorrent").insert_key("chunks_done", d->download()->chunks_done());
f << *d->bencode();
+6 -4
View File
@@ -123,12 +123,14 @@ print_download_title(char* first, char* last, core::Download* d) {
char*
print_download_info(char* first, char* last, core::Download* d) {
first = print_buffer(first, last, "Torrent: ");
if (!d->download()->is_open())
first = print_buffer(first, last, "closed ");
first = print_buffer(first, last, "[CLOSED] ");
else if (!d->download()->is_active())
first = print_buffer(first, last, "[OPEN] ");
else
first = print_buffer(first, last, " ");
else if (d->is_done())
if (d->is_done())
first = print_buffer(first, last, "done %10.1f MB", (double)d->download()->bytes_total() / (double)(1 << 20));
else
first = print_buffer(first, last, "%6.1f / %6.1f MB",