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())