cleanup packet encrypt/descrypt

This commit is contained in:
Kevin Hester
2021-04-05 09:24:00 +08:00
parent 8ef36bcc9c
commit a845406a19
6 changed files with 92 additions and 69 deletions

View File

@@ -2,6 +2,7 @@
#include "NodeDB.h"
#include "main.h"
#include "mesh/Channels.h"
#include "mesh/Router.h"
#include "mesh/generated/mqtt.pb.h"
#include <WiFi.h>
#include <assert.h>
@@ -26,6 +27,11 @@ void MQTT::onPublish(char *topic, byte *payload, unsigned int length)
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)
router->enqueueReceivedMessage(p);
}
// make sure to free both strings and the MeshPacket (passing in NULL is acceptable)
free(e.channel_id);