From d48b92cfb065a68b1d9758a9b1f509b5f62cf2e8 Mon Sep 17 00:00:00 2001 From: Arvid Norberg Date: Fri, 31 Oct 2003 12:07:07 +0000 Subject: [PATCH] *** empty log message *** --- include/libtorrent/torrent_info.hpp | 2 ++ src/torrent.cpp | 10 +++++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/include/libtorrent/torrent_info.hpp b/include/libtorrent/torrent_info.hpp index db56d2878..7e91b6643 100755 --- a/include/libtorrent/torrent_info.hpp +++ b/include/libtorrent/torrent_info.hpp @@ -49,6 +49,8 @@ POSSIBILITY OF SUCH DAMAGE. * */ +// TODO: add std::string comment() and creation_date() + namespace libtorrent { diff --git a/src/torrent.cpp b/src/torrent.cpp index 5779ed40f..1b41efec2 100755 --- a/src/torrent.cpp +++ b/src/torrent.cpp @@ -417,10 +417,18 @@ namespace libtorrent assert(m_unverified_blocks == m_picker.unverified_blocks()); + int blocks_we_have = num_pieces * blocks_per_piece; + const int last_piece = m_torrent_file.num_pieces()-1; + if (p[last_piece]) + { + blocks_we_have += m_picker.blocks_in_piece(last_piece) + - blocks_per_piece; + } + // TODO: Implement total download and total_upload st.total_download = 0; st.total_upload = 0; - st.progress = (num_pieces * blocks_per_piece + m_unverified_blocks) + st.progress = (blocks_we_have + m_unverified_blocks) / static_cast(total_blocks); if (num_pieces == p.size())