From e73ae7cdacdad0d3eb1ce5d06991d60d52af5cd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20G=C3=B6ttgens?= Date: Fri, 30 Dec 2022 14:53:34 +0100 Subject: [PATCH] woops - was too fast there --- src/mesh/Router.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/mesh/Router.cpp b/src/mesh/Router.cpp index 4f60360ce..ee6473b2b 100644 --- a/src/mesh/Router.cpp +++ b/src/mesh/Router.cpp @@ -221,6 +221,8 @@ ErrorCode Router::send(MeshPacket *p) if (p->which_payload_variant == MeshPacket_decoded_tag) { ChannelIndex chIndex = p->channel; // keep as a local because we are about to change it + bool shouldActuallyEncrypt = true; + #if HAS_WIFI || HAS_ETHERNET if(moduleConfig.mqtt.enabled) { // check if we should send decrypted packets to mqtt @@ -235,7 +237,6 @@ ErrorCode Router::send(MeshPacket *p) * => so we only decrypt mqtt if they have a custom mqtt server AND mqtt_encryption_enabled is FALSE */ - bool shouldActuallyEncrypt = true; if (*moduleConfig.mqtt.address && !moduleConfig.mqtt.encryption_enabled) { shouldActuallyEncrypt = false; } @@ -255,7 +256,7 @@ ErrorCode Router::send(MeshPacket *p) } #if HAS_WIFI || HAS_ETHERNET - if(moduleConfig.mqtt.enabled) { + if (moduleConfig.mqtt.enabled) { // the packet is now encrypted. // check if we should send encrypted packets to mqtt if (mqtt && shouldActuallyEncrypt)