mirror of
https://github.com/meshtastic/firmware.git
synced 2025-04-25 09:42:35 +00:00
Filter out neighborinfo if we don't have the module enabled (#3314)
* Filter out neighborinfo if we don't have the module enabled * Handlereceived instead * Add debug message
This commit is contained in:
parent
5865add857
commit
495840c777
@ -435,6 +435,7 @@ NodeNum Router::getNodeNum()
|
|||||||
*/
|
*/
|
||||||
void Router::handleReceived(meshtastic_MeshPacket *p, RxSource src)
|
void Router::handleReceived(meshtastic_MeshPacket *p, RxSource src)
|
||||||
{
|
{
|
||||||
|
bool skipHandle = false;
|
||||||
// Also, we should set the time from the ISR and it should have msec level resolution
|
// Also, we should set the time from the ISR and it should have msec level resolution
|
||||||
p->rx_time = getValidTime(RTCQualityFromNet); // store the arrival timestamp for the phone
|
p->rx_time = getValidTime(RTCQualityFromNet); // store the arrival timestamp for the phone
|
||||||
// Store a copy of encrypted packet for MQTT
|
// Store a copy of encrypted packet for MQTT
|
||||||
@ -451,8 +452,17 @@ void Router::handleReceived(meshtastic_MeshPacket *p, RxSource src)
|
|||||||
else
|
else
|
||||||
printPacket("handleReceived(REMOTE)", p);
|
printPacket("handleReceived(REMOTE)", p);
|
||||||
|
|
||||||
|
// Neighbor info module is disabled, ignore expensive neighbor info packets
|
||||||
|
if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag &&
|
||||||
|
p->decoded.portnum == meshtastic_PortNum_NEIGHBORINFO_APP &&
|
||||||
|
(!moduleConfig.has_neighbor_info || !moduleConfig.neighbor_info.enabled)) {
|
||||||
|
LOG_DEBUG("Neighbor info module is disabled, ignoring neighbor packet\n");
|
||||||
|
cancelSending(p->from, p->id);
|
||||||
|
skipHandle = true;
|
||||||
|
}
|
||||||
|
|
||||||
// Publish received message to MQTT if we're not the original transmitter of the packet
|
// Publish received message to MQTT if we're not the original transmitter of the packet
|
||||||
if (moduleConfig.mqtt.enabled && getFrom(p) != nodeDB.getNodeNum() && mqtt)
|
if (!skipHandle && moduleConfig.mqtt.enabled && getFrom(p) != nodeDB.getNodeNum() && mqtt)
|
||||||
mqtt->onSend(*p_encrypted, *p, p->channel);
|
mqtt->onSend(*p_encrypted, *p, p->channel);
|
||||||
} else {
|
} else {
|
||||||
printPacket("packet decoding failed or skipped (no PSK?)", p);
|
printPacket("packet decoding failed or skipped (no PSK?)", p);
|
||||||
@ -461,6 +471,7 @@ void Router::handleReceived(meshtastic_MeshPacket *p, RxSource src)
|
|||||||
packetPool.release(p_encrypted); // Release the encrypted packet
|
packetPool.release(p_encrypted); // Release the encrypted packet
|
||||||
|
|
||||||
// call modules here
|
// call modules here
|
||||||
|
if (!skipHandle)
|
||||||
MeshModule::callPlugins(*p, src);
|
MeshModule::callPlugins(*p, src);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user