Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Filter out neighborinfo if we don't have the module enabled #3314

Merged
merged 6 commits into from
Mar 3, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions src/mesh/Router.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,7 @@ NodeNum Router::getNodeNum()
*/
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
p->rx_time = getValidTime(RTCQualityFromNet); // store the arrival timestamp for the phone
// Store a copy of encrypted packet for MQTT
Expand All @@ -451,8 +452,17 @@ void Router::handleReceived(meshtastic_MeshPacket *p, RxSource src)
else
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
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);
} else {
printPacket("packet decoding failed or skipped (no PSK?)", p);
Expand All @@ -461,7 +471,8 @@ void Router::handleReceived(meshtastic_MeshPacket *p, RxSource src)
packetPool.release(p_encrypted); // Release the encrypted packet

// call modules here
MeshModule::callPlugins(*p, src);
if (!skipHandle)
MeshModule::callPlugins(*p, src);
}

void Router::perhapsHandleReceived(meshtastic_MeshPacket *p)
Expand Down
Loading