fix piece_picker::max_pieces. it's still restricted by piece_block

This commit is contained in:
Arvid Norberg 2012-04-04 04:23:28 +00:00
parent 46683f59f8
commit 8135a6e3a2
2 changed files with 7 additions and 6 deletions

View File

@ -69,11 +69,11 @@ namespace libtorrent
: piece_index(p_index) : piece_index(p_index)
, block_index(b_index) , block_index(b_index)
{ {
TORRENT_ASSERT(p_index < (1 << 18)); TORRENT_ASSERT(p_index < (1 << 19));
TORRENT_ASSERT(b_index < (1 << 14)); TORRENT_ASSERT(b_index < (1 << 13));
} }
boost::uint32_t piece_index:18; boost::uint32_t piece_index:19;
boost::uint32_t block_index:14; boost::uint32_t block_index:13;
bool operator<(piece_block const& b) const bool operator<(piece_block const& b) const
{ {
@ -598,7 +598,8 @@ namespace libtorrent
#if TORRENT_COMPACT_PICKER #if TORRENT_COMPACT_PICKER
enum { max_pieces = piece_pos::we_have_index - 1 }; enum { max_pieces = piece_pos::we_have_index - 1 };
#else #else
enum { max_pieces = INT_MAX }; // still limited by piece_block
enum { max_pieces = (1 << 19) - 2 };
#endif #endif
}; };

View File

@ -60,7 +60,7 @@ POSSIBILITY OF SUCH DAMAGE.
namespace libtorrent namespace libtorrent
{ {
const piece_block piece_block::invalid(0x3FFFF, 0x3FFF); const piece_block piece_block::invalid(0x7FFFF, 0x1FFF);
piece_picker::piece_picker() piece_picker::piece_picker()
: m_seeds(0) : m_seeds(0)