* Include locally available chunks in the "chunks seen" statistics for completed/distributed copies. Patch by Josef Drexler.

* Added 'd.get_bitfield' command for retrieving the bitfield in hex format. Patch by Thomas Rosner. (PD)

* Fixed include headers for gcc-4.4.0. Patch by 'kloeri'.

* Switched a 'long long' with 'int64_t' in xmlrpc.cc to avoid incompatible types for some systems.


git-svn-id: svn://rakshasa.no/libtorrent/trunk/rtorrent@1092 e378c898-3ddf-0310-93e7-cc216c733640
This commit is contained in:
rakshasa
2009-05-14 13:07:47 +00:00
parent 855bf9a781
commit 63af7078a3
13 changed files with 54 additions and 16 deletions
+8 -6
View File
@@ -131,7 +131,7 @@ Download::receive_storage_error(std::string msg) {
float
Download::distributed_copies() const {
const uint8_t* avail = m_download.chunks_seen();
const uint8_t* end = avail + m_download.file_list()->size_chunks();
const torrent::Bitfield* bitfield = m_download.file_list()->bitfield();
if (avail == NULL)
return 0;
@@ -139,15 +139,17 @@ Download::distributed_copies() const {
int minAvail = std::numeric_limits<uint8_t>::max();
int num = 0;
for (; avail < end; ++avail)
if (*avail == minAvail) {
for (uint32_t i = m_download.file_list()->size_chunks(); i-- > 0; ) {
int totAvail = (int)avail[i] + bitfield->get(i);
if (totAvail == minAvail) {
num++;
} else if (*avail < minAvail) {
minAvail = *avail;
} else if (totAvail < minAvail) {
minAvail = totAvail;
num = 1;
}
}
return minAvail + 1 - (float)num / m_download.file_list()->size_chunks();
return minAvail + 1 - bitfield->is_all_set() - (float)num / m_download.file_list()->size_chunks();
}
void