mirror of
https://github.com/rakshasa/rtorrent.git
synced 2026-08-12 13:12:32 +00:00
* Removed Content and moved stuff to DownloadWrapper and FileList.
* Using a char buffer instead of std::string in Handshake::prepare_key_plus_pad(). git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@813 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
@@ -227,7 +227,7 @@ Download::priority_to_string(uint32_t p) {
|
||||
float
|
||||
Download::distributed_copies() const {
|
||||
const uint8_t* avail = m_download.chunks_seen();
|
||||
const uint8_t* end = avail + m_download.chunks_total();
|
||||
const uint8_t* end = avail + m_download.file_list()->size_chunks();
|
||||
|
||||
if (avail == NULL)
|
||||
return 0;
|
||||
@@ -243,7 +243,7 @@ Download::distributed_copies() const {
|
||||
num = 1;
|
||||
}
|
||||
|
||||
return minAvail + 1 - (float)num / m_download.chunks_total();
|
||||
return minAvail + 1 - (float)num / m_download.file_list()->size_chunks();
|
||||
}
|
||||
|
||||
void
|
||||
|
||||
+2
-1
@@ -43,6 +43,7 @@
|
||||
#include <torrent/hash_string.h>
|
||||
#include <torrent/tracker_list.h>
|
||||
#include <torrent/torrent.h>
|
||||
#include <torrent/data/file_list.h>
|
||||
|
||||
#include "utils/variable_map.h"
|
||||
|
||||
@@ -66,7 +67,7 @@ public:
|
||||
|
||||
bool is_open() const { return m_download.is_open(); }
|
||||
bool is_active() const { return m_download.is_active(); }
|
||||
bool is_done() const { return m_download.chunks_done() == m_download.chunks_total(); }
|
||||
bool is_done() const { return m_download.file_list()->is_done(); }
|
||||
bool is_downloading() const { return is_active() && !is_done(); }
|
||||
bool is_seeding() const { return is_active() && is_done(); }
|
||||
|
||||
|
||||
@@ -296,7 +296,7 @@ DownloadFactory::initialize_rtorrent(Download* download, torrent::Object* rtorre
|
||||
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()));
|
||||
download->download()->set_chunks_done(std::min<uint32_t>(rtorrent->get_key_value("chunks_done"), download->download()->file_list()->completed_chunks()));
|
||||
|
||||
if (!rtorrent->has_key_value("ignore_commands"))
|
||||
rtorrent->insert_key("ignore_commands", (int64_t)0);
|
||||
|
||||
@@ -107,7 +107,7 @@ DownloadStore::save(Download* d) {
|
||||
|
||||
// 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());
|
||||
d->bencode()->get_key("rtorrent").insert_key("chunks_done", d->download()->file_list()->completed_chunks());
|
||||
|
||||
torrent::Object& resumeObject = d->download()->bencode()->get_key("libtorrent_resume");
|
||||
|
||||
|
||||
Reference in New Issue
Block a user