From a48cb785d0ce6eb1fe5d1db84b7c1353634e3518 Mon Sep 17 00:00:00 2001 From: arvidn Date: Sat, 7 Nov 2015 18:50:54 -0500 Subject: [PATCH] forward port piece_block patch from RC_1_0 --- ChangeLog | 1 + include/libtorrent/piece_picker.hpp | 11 ++++------- src/piece_picker.cpp | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 49e336473..11ceb4144 100644 --- a/ChangeLog +++ b/ChangeLog @@ -78,6 +78,7 @@ 1.0.7 release + * fix support for torrents with > 500'000 pieces * fix ip filter bug when banning peers * fix IPv6 IP address resolution in URLs * introduce run-time check for torrent info-sections beeing too large diff --git a/include/libtorrent/piece_picker.hpp b/include/libtorrent/piece_picker.hpp index 577479939..9ec886eb4 100644 --- a/include/libtorrent/piece_picker.hpp +++ b/include/libtorrent/piece_picker.hpp @@ -79,15 +79,13 @@ namespace libtorrent static const piece_block invalid; piece_block() {} - piece_block(boost::uint32_t p_index, boost::uint16_t b_index) + piece_block(int p_index, int b_index) : piece_index(p_index) , block_index(b_index) { - TORRENT_ASSERT(p_index < (1 << 19)); - TORRENT_ASSERT(b_index < (1 << 13)); } - boost::uint32_t piece_index:19; - boost::uint32_t block_index:13; + int piece_index; + int block_index; bool operator<(piece_block const& b) const { @@ -838,8 +836,7 @@ namespace libtorrent #ifdef TORRENT_OPTIMIZE_MEMORY_USAGE enum { max_pieces = piece_pos::we_have_index - 1 }; #else - // still limited by piece_block - enum { max_pieces = (1 << 19) - 2 }; + enum { max_pieces = (std::numeric_limits::max)() - 1 }; #endif }; diff --git a/src/piece_picker.cpp b/src/piece_picker.cpp index 2677aebdc..421fd654d 100644 --- a/src/piece_picker.cpp +++ b/src/piece_picker.cpp @@ -68,7 +68,7 @@ POSSIBILITY OF SUCH DAMAGE. namespace libtorrent { - const piece_block piece_block::invalid(0x7FFFF, 0x1FFF); + const piece_block piece_block::invalid((std::numeric_limits::max)(), (std::numeric_limits::max)()); piece_picker::piece_picker() : m_seeds(0)