fix some left-over incorrect default piece priorities (1 -> 4)

This commit is contained in:
arvidn 2017-02-11 09:33:01 -05:00 committed by Arvid Norberg
parent db32618c39
commit 85f6febfff
2 changed files with 5 additions and 5 deletions

View File

@ -436,9 +436,9 @@ namespace libtorrent
void default_storage::set_file_priority(std::vector<boost::uint8_t> const& prio, storage_error& ec)
{
// extend our file priorities in case it's truncated
// the default assumed priority is 1
// the default assumed priority is 4 (the default)
if (prio.size() > m_file_priority.size())
m_file_priority.resize(prio.size(), 1);
m_file_priority.resize(prio.size(), 4);
file_storage const& fs = files();
for (int i = 0; i < int(prio.size()); ++i)

View File

@ -5589,7 +5589,7 @@ namespace libtorrent
std::copy(files.begin(), files.begin() + limit, m_file_priority.begin());
if (valid_metadata() && m_torrent_file->num_files() > int(m_file_priority.size()))
m_file_priority.resize(m_torrent_file->num_files(), 1);
m_file_priority.resize(m_torrent_file->num_files(), 4);
// initialize pad files to priority 0
file_storage const& fs = m_torrent_file->files();
@ -10604,7 +10604,7 @@ namespace libtorrent
if (ps.peer_count == 0) continue;
if (ps.priority == 0 && (ps.have || ps.downloading))
{
m_picker->set_piece_priority(i, 1);
m_picker->set_piece_priority(i, 4);
continue;
}
// don't count pieces we already have or are trying to download
@ -10637,7 +10637,7 @@ namespace libtorrent
// now, pick one of the rarest pieces to download
int pick = random() % rarest_pieces.size();
bool was_finished = is_finished();
m_picker->set_piece_priority(rarest_pieces[pick], 1);
m_picker->set_piece_priority(rarest_pieces[pick], 4);
update_gauge();
update_peer_interest(was_finished);
update_want_peers();