object download prio, not set anywhere yet, but the code is there now

This commit is contained in:
2024-07-10 11:13:57 +02:00
parent ef91ec14fc
commit 822b979286
3 changed files with 32 additions and 4 deletions

View File

@@ -146,8 +146,22 @@ void ChunkPicker::updateParticipation(
}
if (!o.get<Components::FT1ChunkSHA1Cache>().have_all) {
// TODO: set priority
participating_unfinished.emplace(o, ParticipationEntry{});
using Priority = Components::DownloadPriority::Priority;
Priority prio = Priority::NORMAL;
if (o.all_of<Components::DownloadPriority>()) {
prio = o.get<Components::DownloadPriority>().p;
}
uint16_t pskips =
prio == Priority::HIGHER ? 0u :
prio == Priority::HIGH ? 1u :
prio == Priority::NORMAL ? 2u :
prio == Priority::LOW ? 4u :
8u
;
participating_unfinished.emplace(o, ParticipationEntry{pskips});
}
}
checked.emplace(o);