diff --git a/solanaceae/ngc_ft1_sha1/sha1_ngcft1.cpp b/solanaceae/ngc_ft1_sha1/sha1_ngcft1.cpp index dcd7c90..e8c3d76 100644 --- a/solanaceae/ngc_ft1_sha1/sha1_ngcft1.cpp +++ b/solanaceae/ngc_ft1_sha1/sha1_ngcft1.cpp @@ -1432,6 +1432,11 @@ bool SHA1_NGCFT1::onEvent(const Events::NGCEXT_ft1_have& e) { //c.emplace_or_replace(); } + if (!o.all_of()) { + // we dont have the info yet + return true; + } + const size_t num_total_chunks = o.get().chunks.size(); auto& remote_have = o.get_or_emplace().others; @@ -1517,6 +1522,17 @@ bool SHA1_NGCFT1::onEvent(const Events::NGCEXT_ft1_bitset& e) { std::cerr << "SHA1_NGCFT1 error: tracking info has null object\n"; return false; } + const auto c = _tcm.getContactGroupPeer(e.group_number, e.peer_number); + assert(static_cast(c)); + _tox_peer_to_contact[combine_ids(e.group_number, e.peer_number)] = c; // cache + + // we might not know yet + addParticipation(c, o); + + if (!o.all_of()) { + // we dont have the info yet + return true; + } const size_t num_total_chunks = o.get().chunks.size(); // +7 for byte rounding @@ -1526,13 +1542,6 @@ bool SHA1_NGCFT1::onEvent(const Events::NGCEXT_ft1_bitset& e) { return false; } - const auto c = _tcm.getContactGroupPeer(e.group_number, e.peer_number); - assert(static_cast(c)); - _tox_peer_to_contact[combine_ids(e.group_number, e.peer_number)] = c; // cache - - // we might not know yet - addParticipation(c, o); - auto& remote_have = o.get_or_emplace().others; if (!remote_have.contains(c)) { // init