fix missized local have bitset

This commit is contained in:
Green Sky 2024-07-25 14:57:27 +02:00
parent da406714ff
commit 8bd2c925a6
No known key found for this signature in database
2 changed files with 3 additions and 3 deletions

View File

@ -285,7 +285,7 @@ std::vector<ChunkPicker::ContentChunkR> ChunkPicker::updateChunkRequests(
const auto* lhb = o.try_get<ObjComp::F::LocalHaveBitset>(); const auto* lhb = o.try_get<ObjComp::F::LocalHaveBitset>();
// if we dont have anything, this might not exist yet // if we dont have anything, this might not exist yet
BitSet chunk_candidates = lhb == nullptr ? BitSet{total_chunks} : lhb->have; BitSet chunk_candidates = lhb == nullptr ? BitSet{total_chunks} : (lhb->have.size_bits() >= total_chunks ? lhb->have : BitSet{total_chunks});
if (!other_have.have_all) { if (!other_have.have_all) {
// AND is the same as ~(~A | ~B) // AND is the same as ~(~A | ~B)

View File

@ -573,7 +573,7 @@ bool SHA1_NGCFT1::onEvent(const ObjectStore::Events::ObjectUpdate& e) {
{ // next, create chuck cache and check for existing data { // next, create chuck cache and check for existing data
auto& transfer_stats = e.e.get_or_emplace<ObjComp::Ephemeral::File::TransferStats>(); auto& transfer_stats = e.e.get_or_emplace<ObjComp::Ephemeral::File::TransferStats>();
auto& lhb = e.e.get_or_emplace<ObjComp::F::LocalHaveBitset>(); auto& lhb = e.e.get_or_emplace<ObjComp::F::LocalHaveBitset>();
if (lhb.have.size_bytes() < info.chunks.size()/8) { if (lhb.have.size_bits() < info.chunks.size()) {
lhb.have = BitSet{info.chunks.size()}; lhb.have = BitSet{info.chunks.size()};
} }
auto& cc = e.e.emplace<Components::FT1ChunkSHA1Cache>(); auto& cc = e.e.emplace<Components::FT1ChunkSHA1Cache>();
@ -1027,7 +1027,7 @@ bool SHA1_NGCFT1::onEvent(const Events::NGCFT1_recv_done& e) {
if (!o.all_of<ObjComp::F::TagLocalHaveAll>()) { if (!o.all_of<ObjComp::F::TagLocalHaveAll>()) {
{ {
auto& lhb = o.get_or_emplace<ObjComp::F::LocalHaveBitset>(info.chunks.size()); auto& lhb = o.get_or_emplace<ObjComp::F::LocalHaveBitset>(BitSet{info.chunks.size()});
for (const auto inner_chunk_index : transfer.getChunk().chunk_indices) { for (const auto inner_chunk_index : transfer.getChunk().chunk_indices) {
if (lhb.have[inner_chunk_index]) { if (lhb.have[inner_chunk_index]) {
continue; continue;