From af5a6e82a1bf35ff9ea52a88adb6bc8009b4dff1 Mon Sep 17 00:00:00 2001 From: Eric Severance Date: Mon, 16 Dec 2024 20:24:58 -0800 Subject: [PATCH] const DecodedServiceEnvelope e --- src/mqtt/MQTT.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mqtt/MQTT.cpp b/src/mqtt/MQTT.cpp index c6cdfcf1b..9eed4dac8 100644 --- a/src/mqtt/MQTT.cpp +++ b/src/mqtt/MQTT.cpp @@ -35,6 +35,11 @@ static MemoryDynamic staticMqttPool; Allocator &mqttPool = staticMqttPool; +// FIXME - this size calculation is super sloppy, but it will go away once we dynamically alloc meshpackets +static uint8_t bytes[meshtastic_MqttClientProxyMessage_size + 30]; // 12 for channel name and 16 for nodeid + +static bool isMqttServerAddressPrivate = false; + // meshtastic_ServiceEnvelope that automatically releases dynamically allocated memory when it goes out of scope. struct DecodedServiceEnvelope : public meshtastic_ServiceEnvelope { DecodedServiceEnvelope() = delete; @@ -48,14 +53,9 @@ struct DecodedServiceEnvelope : public meshtastic_ServiceEnvelope { const bool validDecode; }; -// FIXME - this size calculation is super sloppy, but it will go away once we dynamically alloc meshpackets -static uint8_t bytes[meshtastic_MqttClientProxyMessage_size + 30]; // 12 for channel name and 16 for nodeid - -static bool isMqttServerAddressPrivate = false; - inline void onReceiveProto(char *topic, byte *payload, size_t length) { - DecodedServiceEnvelope e(payload, length); + const DecodedServiceEnvelope e(payload, length); if (!e.validDecode) { LOG_ERROR("Invalid MQTT service envelope, topic %s, len %u!", topic, length); return;