* simple_secure_chat: bug fixes

This commit is contained in:
Scott Powell
2025-01-13 16:57:01 +11:00
parent d291c6d31e
commit d06532d6f1
3 changed files with 17 additions and 6 deletions

View File

@@ -70,6 +70,7 @@ DispatcherAction Mesh::onRecvPacket(Packet* pkt) {
// scan contacts DB, for all matching hashes of 'src_hash' (max 4 matches supported ATM)
int num = searchPeersByHash(&src_hash);
// for each matching contact, try to decrypt data
bool found = false;
for (int j = 0; j < num; j++) {
uint8_t secret[PUB_KEY_SIZE];
getPeerSharedSecret(secret, j);
@@ -89,9 +90,13 @@ DispatcherAction Mesh::onRecvPacket(Packet* pkt) {
} else {
onPeerDataRecv(pkt, pkt->getPayloadType(), j, data, len);
}
found = true;
break;
}
}
if (!found) {
MESH_DEBUG_PRINTLN("recv matches no peers, src_hash=%02X", (uint32_t)src_hash);
}
}
action = routeRecvPacket(pkt);
}