mqtt: downlink now works

This commit is contained in:
Kevin Hester
2021-04-05 09:38:00 +08:00
parent a845406a19
commit 7f5ab472b9
2 changed files with 313 additions and 307 deletions

View File

@@ -26,11 +26,14 @@ void MQTT::onPublish(char *topic, byte *payload, unsigned int length)
} else {
DEBUG_MSG("Received MQTT topic %s, len=%u\n", topic, length);
// FIXME, ignore messages sent by us (requires decryption) or if we don't have the channel key
if (e.packet) {
MeshPacket *p = packetPool.allocCopy(*e.packet);
if (router)
// ignore messages sent by us or if we don't have the channel key
if (router && p->from != nodeDB.getNodeNum() && perhapsDecode(p))
router->enqueueReceivedMessage(p);
else
packetPool.release(p);
}
// make sure to free both strings and the MeshPacket (passing in NULL is acceptable)