early out have when we have all
This commit is contained in:
parent
ba809eda43
commit
adeaca4efe
@ -1399,8 +1399,6 @@ bool SHA1_NGCFT1::onEvent(const Events::NGCEXT_ft1_have& e) {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
const size_t num_total_chunks = o.get<Components::FT1InfoSHA1>().chunks.size();
|
|
||||||
|
|
||||||
const auto c = _tcm.getContactGroupPeer(e.group_number, e.peer_number);
|
const auto c = _tcm.getContactGroupPeer(e.group_number, e.peer_number);
|
||||||
assert(static_cast<bool>(c));
|
assert(static_cast<bool>(c));
|
||||||
_tox_peer_to_contact[combine_ids(e.group_number, e.peer_number)] = c; // cache
|
_tox_peer_to_contact[combine_ids(e.group_number, e.peer_number)] = c; // cache
|
||||||
@ -1411,6 +1409,8 @@ bool SHA1_NGCFT1::onEvent(const Events::NGCEXT_ft1_have& e) {
|
|||||||
//c.emplace_or_replace<ChunkPickerUpdateTag>();
|
//c.emplace_or_replace<ChunkPickerUpdateTag>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const size_t num_total_chunks = o.get<Components::FT1InfoSHA1>().chunks.size();
|
||||||
|
|
||||||
auto& remote_have = o.get_or_emplace<Components::RemoteHaveBitset>().others;
|
auto& remote_have = o.get_or_emplace<Components::RemoteHaveBitset>().others;
|
||||||
if (!remote_have.contains(c)) {
|
if (!remote_have.contains(c)) {
|
||||||
// init
|
// init
|
||||||
@ -1420,6 +1420,10 @@ bool SHA1_NGCFT1::onEvent(const Events::NGCEXT_ft1_have& e) {
|
|||||||
//c.emplace_or_replace<ChunkPickerUpdateTag>();
|
//c.emplace_or_replace<ChunkPickerUpdateTag>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (o.all_of<ObjComp::F::TagLocalHaveAll>()) {
|
||||||
|
return true; // we dont care beyond this point
|
||||||
|
}
|
||||||
|
|
||||||
auto& remote_have_peer = remote_have.at(c);
|
auto& remote_have_peer = remote_have.at(c);
|
||||||
if (remote_have_peer.have_all) {
|
if (remote_have_peer.have_all) {
|
||||||
return true; // peer somehow already had all, ignoring
|
return true; // peer somehow already had all, ignoring
|
||||||
|
@ -251,7 +251,6 @@ std::vector<uint8_t> NGCHS2Send::buildHSFileRange(Contact3Handle c, uint64_t ts_
|
|||||||
continue; // skip
|
continue; // skip
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const auto& [c_from_c, c_to_c] = msg_reg.get<Message::Components::ContactFrom, Message::Components::ContactTo>(e);
|
const auto& [c_from_c, c_to_c] = msg_reg.get<Message::Components::ContactFrom, Message::Components::ContactTo>(e);
|
||||||
|
|
||||||
if (c_to_c.c != c) {
|
if (c_to_c.c != c) {
|
||||||
|
Loading…
Reference in New Issue
Block a user