From 100279a48372719192da894d18254022d9a09bcc Mon Sep 17 00:00:00 2001 From: Green Sky Date: Tue, 10 Dec 2024 17:57:53 +0100 Subject: [PATCH] fixes --- solanaceae/ngc_ft1_sha1/sha1_ngcft1.cpp | 23 ++++++++++++++++------- 1 file changed, 16 insertions(+), 7 deletions(-) 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