made the sequential download mode slightly more sequential (by letting more categories of peers request early pieces). Disabled speed affinity and prefer_whole_pieces when in sequential download mode
This commit is contained in:
parent
bd1757fbd2
commit
3f94cc8857
|
@ -129,7 +129,11 @@ namespace libtorrent
|
||||||
// always pick partial pieces before any other piece
|
// always pick partial pieces before any other piece
|
||||||
prioritize_partials = 8,
|
prioritize_partials = 8,
|
||||||
// pick pieces in sequential order
|
// pick pieces in sequential order
|
||||||
sequential = 16
|
sequential = 16,
|
||||||
|
// have affinity to pieces with the same speed category
|
||||||
|
speed_affinity = 32,
|
||||||
|
// ignore the prefer_whole_pieces parameter
|
||||||
|
ignore_whole_pieces = 64
|
||||||
};
|
};
|
||||||
|
|
||||||
struct downloading_piece
|
struct downloading_piece
|
||||||
|
|
|
@ -617,7 +617,7 @@ namespace libtorrent
|
||||||
|
|
||||||
if (t->is_sequential_download())
|
if (t->is_sequential_download())
|
||||||
{
|
{
|
||||||
ret |= piece_picker::sequential;
|
ret |= piece_picker::sequential | piece_picker::ignore_whole_pieces;
|
||||||
}
|
}
|
||||||
else if (t->num_have() < t->settings().initial_picker_threshold)
|
else if (t->num_have() < t->settings().initial_picker_threshold)
|
||||||
{
|
{
|
||||||
|
@ -628,7 +628,7 @@ namespace libtorrent
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
ret |= piece_picker::rarest_first;
|
ret |= piece_picker::rarest_first | piece_picker::speed_affinity;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_snubbed)
|
if (m_snubbed)
|
||||||
|
|
|
@ -1319,6 +1319,12 @@ namespace libtorrent
|
||||||
// peer
|
// peer
|
||||||
// * prioritize_partials
|
// * prioritize_partials
|
||||||
// pick blocks from downloading pieces first
|
// pick blocks from downloading pieces first
|
||||||
|
// * speed_affinity
|
||||||
|
// have an affinity to pick pieces in the same speed
|
||||||
|
// category.
|
||||||
|
// * ignore_whole_pieces
|
||||||
|
// ignores the prefer_whole_pieces parameter (as if
|
||||||
|
// it was 0)
|
||||||
|
|
||||||
// only one of rarest_first, sequential can be set
|
// only one of rarest_first, sequential can be set
|
||||||
|
|
||||||
|
@ -1330,6 +1336,8 @@ namespace libtorrent
|
||||||
// prevent the number of partial pieces to grow indefinitely
|
// prevent the number of partial pieces to grow indefinitely
|
||||||
if (m_downloads.size() > 20) options |= prioritize_partials;
|
if (m_downloads.size() > 20) options |= prioritize_partials;
|
||||||
|
|
||||||
|
if (options & ignore_whole_pieces) prefer_whole_pieces = 0;
|
||||||
|
|
||||||
// only one of rarest_first and sequential can be set.
|
// only one of rarest_first and sequential can be set.
|
||||||
TORRENT_ASSERT(bool(options & rarest_first)
|
TORRENT_ASSERT(bool(options & rarest_first)
|
||||||
+ bool(options & sequential) <= 1);
|
+ bool(options & sequential) <= 1);
|
||||||
|
@ -1812,7 +1820,7 @@ namespace libtorrent
|
||||||
// if the state of the piece is none (the
|
// if the state of the piece is none (the
|
||||||
// piece will in that case change state).
|
// piece will in that case change state).
|
||||||
if (dp.state != none && dp.state != speed
|
if (dp.state != none && dp.state != speed
|
||||||
&& !exclusive_active)
|
&& !exclusive_active && (options & speed_affinity))
|
||||||
{
|
{
|
||||||
if (abs(dp.state - speed) == 1)
|
if (abs(dp.state - speed) == 1)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue