Skip to content
Open
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
11 changes: 10 additions & 1 deletion src/mesh/RadioLibInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,16 @@ void RadioLibInterface::handleReceiveInterrupt()

mp->which_payload_variant =
meshtastic_MeshPacket_encrypted_tag; // Mark that the payload is still encrypted at this point
assert(((uint32_t)payloadLen) <= sizeof(mp->encrypted.bytes));
if ((uint32_t)payloadLen > sizeof(mp->encrypted.bytes)) {
LOG_WARN("Drop oversized RX packet (%d > %u)", payloadLen, (unsigned)sizeof(mp->encrypted.bytes));
packetPool.release(mp);
// The outer else branch already incremented rxGood for this packet;
// undo that and reclassify as rxBad so num_packets_rx isn't double-counted.
rxGood--;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These statistics are really about whether it was correctly decoded when receiving over the air, which is the case (the CRC must have passed if you reach here), hence "rxGood" is still correct.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i'm with @GUVWAF here. don't touch the RX statistics at all, just make it fail gracefully instead of asserting. Also aomething to note: this was in place originally as a 'safeguard' against people stuffing too much into a meshpacket, so more of a sanity check. Arguably a happy path decision.

rxBad++;
airTime->logAirtime(RX_ALL_LOG, rxMsec);
return;
Comment thread
thebentern marked this conversation as resolved.
}
memcpy(mp->encrypted.bytes, radioBuffer.payload, payloadLen);
mp->encrypted.size = payloadLen;

Expand Down
Loading