Handle repeated packet after potentially canceling previous Tx (#5330)

* Revert "Fix sending duplicate packets to PhoneAPI/MQTT (#5315)"

This reverts commit 40bc04b521.

* Handle repeated packet after potentially canceling previous Tx
This commit is contained in:
GUVWAF
2024-11-12 22:23:32 +01:00
committed by GitHub
parent 2ec3958cd8
commit e866734a25
8 changed files with 47 additions and 48 deletions

View File

@@ -622,17 +622,9 @@ void Router::handleReceived(meshtastic_MeshPacket *p, RxSource src)
// us (because we would be able to decrypt it)
if (!decoded && moduleConfig.mqtt.encryption_enabled && p->channel == 0x00 && !isBroadcast(p->to) && !isToUs(p))
p_encrypted->pki_encrypted = true;
// After potentially altering it, publish received message to MQTT if we're not the original transmitter of the packet
if ((decoded || p_encrypted->pki_encrypted) && moduleConfig.mqtt.enabled && !isFromUs(p) && mqtt) {
// Check if it wasn't already seen, then we don't need to handle it again
bool isRepeated = false;
bool *rptr = &isRepeated;
wasSeenRecently(p, false, rptr);
if (!isRepeated) {
mqtt->onSend(*p_encrypted, *p, p->channel);
}
}
if ((decoded || p_encrypted->pki_encrypted) && moduleConfig.mqtt.enabled && !isFromUs(p) && mqtt)
mqtt->onSend(*p_encrypted, *p, p->channel);
#endif
}