Skip to content

Commit b868279

Browse files
RCGV1thebentern
authored andcommitted
Drop PKI acks if there is no downlink on MQTTClientProxy (#8580)
* Discard everything if downlink isn't on * Drop PKI packets when downlink not on
1 parent b707001 commit b868279

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

src/mqtt/MQTT.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,20 @@ inline void onReceiveProto(char *topic, byte *payload, size_t length)
6666
(strcmp(e.channel_id, channels.getGlobalId(ch.index)) == 0 && ch.settings.downlink_enabled))) {
6767
return;
6868
}
69+
70+
bool anyChannelHasDownlink = false;
71+
size_t numChan = channels.getNumChannels();
72+
for (size_t i = 0; i < numChan; ++i) {
73+
const auto &c = channels.getByIndex(i);
74+
if (c.settings.downlink_enabled) {
75+
anyChannelHasDownlink = true;
76+
break;
77+
}
78+
}
79+
80+
if (strcmp(e.channel_id, "PKI") == 0 && !anyChannelHasDownlink) {
81+
return;
82+
}
6983
// Generate node ID from nodenum for comparison
7084
std::string nodeId = nodeDB->getNodeId();
7185
if (strcmp(e.gateway_id, nodeId.c_str()) == 0) {

0 commit comments

Comments
 (0)