forked from premiere/premiere-libtorrent
merged piece picker fix from RC_0_16
This commit is contained in:
parent
2aacf1cd66
commit
07f9133ba9
|
@ -12,6 +12,7 @@
|
||||||
* fix uTP edge case where udp socket buffer fills up
|
* fix uTP edge case where udp socket buffer fills up
|
||||||
* fix nagle implementation in uTP
|
* fix nagle implementation in uTP
|
||||||
|
|
||||||
|
* fixed piece picker bug when using pad-files
|
||||||
* fix read-piece response for cancelled deadline-pieces
|
* fix read-piece response for cancelled deadline-pieces
|
||||||
* fixed file priority vector-overrun
|
* fixed file priority vector-overrun
|
||||||
* fix potential packet allocation alignment issue in utp
|
* fix potential packet allocation alignment issue in utp
|
||||||
|
|
|
@ -230,6 +230,7 @@ namespace libtorrent
|
||||||
TORRENT_ASSERT(i->piece_index < bits.size());
|
TORRENT_ASSERT(i->piece_index < bits.size());
|
||||||
TORRENT_ASSERT(bits[i->piece_index]);
|
TORRENT_ASSERT(bits[i->piece_index]);
|
||||||
TORRENT_ASSERT(!m_piece_map[i->piece_index].have());
|
TORRENT_ASSERT(!m_piece_map[i->piece_index].have());
|
||||||
|
TORRENT_ASSERT(!m_piece_map[i->piece_index].filtered());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1483,6 +1484,8 @@ namespace libtorrent
|
||||||
// make this scale by the number of peers we have. For large
|
// make this scale by the number of peers we have. For large
|
||||||
// scale clients, we would have more peers, and allow a higher
|
// scale clients, we would have more peers, and allow a higher
|
||||||
// threshold for the number of partials
|
// threshold for the number of partials
|
||||||
|
// TODO: 2 m_downloads size will be > 0 just by having pad-files
|
||||||
|
// in the torrent. That should be taken into account here.
|
||||||
if (m_downloads.size() > num_peers * 3 / 2) options |= prioritize_partials;
|
if (m_downloads.size() > num_peers * 3 / 2) options |= prioritize_partials;
|
||||||
|
|
||||||
if (options & ignore_whole_pieces) prefer_whole_pieces = 0;
|
if (options & ignore_whole_pieces) prefer_whole_pieces = 0;
|
||||||
|
@ -1519,7 +1522,7 @@ namespace libtorrent
|
||||||
for (std::vector<downloading_piece>::const_iterator i = m_downloads.begin()
|
for (std::vector<downloading_piece>::const_iterator i = m_downloads.begin()
|
||||||
, end(m_downloads.end()); i != end; ++i)
|
, end(m_downloads.end()); i != end; ++i)
|
||||||
{
|
{
|
||||||
if (!pieces[i->index]) continue;
|
if (!is_piece_free(i->index, pieces)) continue;
|
||||||
if (m_piece_map[i->index].full
|
if (m_piece_map[i->index].full
|
||||||
&& backup_blocks.size() >= num_blocks
|
&& backup_blocks.size() >= num_blocks
|
||||||
&& backup_blocks2.size() >= num_blocks)
|
&& backup_blocks2.size() >= num_blocks)
|
||||||
|
@ -1675,6 +1678,7 @@ namespace libtorrent
|
||||||
num_blocks_in_piece = num_blocks;
|
num_blocks_in_piece = num_blocks;
|
||||||
for (int j = 0; j < num_blocks_in_piece; ++j)
|
for (int j = 0; j < num_blocks_in_piece; ++j)
|
||||||
{
|
{
|
||||||
|
TORRENT_ASSERT(is_piece_free(k, pieces));
|
||||||
interesting_blocks.push_back(piece_block(k, j));
|
interesting_blocks.push_back(piece_block(k, j));
|
||||||
--num_blocks;
|
--num_blocks;
|
||||||
}
|
}
|
||||||
|
@ -1935,6 +1939,7 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
if (num_blocks_in_piece > num_blocks)
|
if (num_blocks_in_piece > num_blocks)
|
||||||
num_blocks_in_piece = num_blocks;
|
num_blocks_in_piece = num_blocks;
|
||||||
|
TORRENT_ASSERT(is_piece_free(piece, pieces));
|
||||||
for (int j = 0; j < num_blocks_in_piece; ++j)
|
for (int j = 0; j < num_blocks_in_piece; ++j)
|
||||||
interesting_blocks.push_back(piece_block(piece, j));
|
interesting_blocks.push_back(piece_block(piece, j));
|
||||||
num_blocks -= num_blocks_in_piece;
|
num_blocks -= num_blocks_in_piece;
|
||||||
|
@ -1947,6 +1952,7 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
TORRENT_ASSERT(m_piece_map[k].priority(this) > 0);
|
TORRENT_ASSERT(m_piece_map[k].priority(this) > 0);
|
||||||
num_blocks_in_piece = blocks_in_piece(k);
|
num_blocks_in_piece = blocks_in_piece(k);
|
||||||
|
TORRENT_ASSERT(is_piece_free(k, pieces));
|
||||||
for (int j = 0; j < num_blocks_in_piece; ++j)
|
for (int j = 0; j < num_blocks_in_piece; ++j)
|
||||||
{
|
{
|
||||||
interesting_blocks.push_back(piece_block(k, j));
|
interesting_blocks.push_back(piece_block(k, j));
|
||||||
|
@ -1970,6 +1976,7 @@ namespace libtorrent
|
||||||
, void* peer, piece_state_t speed, int options) const
|
, void* peer, piece_state_t speed, int options) const
|
||||||
{
|
{
|
||||||
if (!pieces[dp.index]) return num_blocks;
|
if (!pieces[dp.index]) return num_blocks;
|
||||||
|
if (m_piece_map[dp.index].filtered()) return num_blocks;
|
||||||
|
|
||||||
int num_blocks_in_piece = blocks_in_piece(dp.index);
|
int num_blocks_in_piece = blocks_in_piece(dp.index);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue