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:
Arvid Norberg 2009-01-14 09:07:27 +00:00
parent bd1757fbd2
commit 3f94cc8857
3 changed files with 16 additions and 4 deletions

View File

@ -129,7 +129,11 @@ namespace libtorrent
// always pick partial pieces before any other piece
prioritize_partials = 8,
// 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

View File

@ -617,7 +617,7 @@ namespace libtorrent
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)
{
@ -628,7 +628,7 @@ namespace libtorrent
}
else
{
ret |= piece_picker::rarest_first;
ret |= piece_picker::rarest_first | piece_picker::speed_affinity;
}
if (m_snubbed)

View File

@ -1319,6 +1319,12 @@ namespace libtorrent
// peer
// * prioritize_partials
// 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
@ -1330,6 +1336,8 @@ namespace libtorrent
// prevent the number of partial pieces to grow indefinitely
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.
TORRENT_ASSERT(bool(options & rarest_first)
+ bool(options & sequential) <= 1);
@ -1812,7 +1820,7 @@ namespace libtorrent
// if the state of the piece is none (the
// piece will in that case change state).
if (dp.state != none && dp.state != speed
&& !exclusive_active)
&& !exclusive_active && (options & speed_affinity))
{
if (abs(dp.state - speed) == 1)
{