Browse Source

Address comments

pull/1677/head
Wessel Nieboer 6 months ago
parent
commit
61a664a955
No known key found for this signature in database GPG Key ID: 929C8E45E33B5FD2
  1. 2
      src/Mesh.cpp
  2. 4
      src/helpers/BaseChatMesh.cpp

2
src/Mesh.cpp

@ -145,7 +145,7 @@ DispatcherAction Mesh::onRecvPacket(Packet* pkt) {
// FUTURE: could send back multiple paths, using createPathReturn(), and let sender choose which to use(?)
if (self_id.isHashMatch(&dest_hash)) {
// scan contacts DB, for all matching hashes of 'src_hash' (max 4 matches supported ATM)
// scan contacts DB, for all matching hashes of 'src_hash' (max 8 matches supported ATM)
int num = searchPeersByHash(&src_hash);
// for each matching contact, try to decrypt data
bool found = false;

4
src/helpers/BaseChatMesh.cpp

@ -1208,7 +1208,7 @@ bool BaseChatMesh::shouldInitiateSessionKey(const ContactInfo& contact) {
if (!(contact.flags & CONTACT_FLAG_AEAD)) return false;
// Need a known path to send the request
if (contact.out_path_len < 0) return false;
if (contact.out_path_len == OUT_PATH_UNKNOWN) return false;
auto entry = findSessionKey(contact.id.pub_key);
@ -1443,9 +1443,9 @@ void BaseChatMesh::onSessionKeyDecryptSuccess(int peer_idx) {
if (changed) {
memset(entry->prev_session_key, 0, SESSION_KEY_SIZE);
entry->state = SESSION_STATE_ACTIVE;
onSessionKeysUpdated();
}
entry->sends_since_last_recv = 0;
if (changed) onSessionKeysUpdated();
}
}
}

Loading…
Cancel
Save