Skip to content

Commit

Permalink
skip decode/decrypt again, but assign channel accoding enc-key
Browse files Browse the repository at this point in the history
  • Loading branch information
sbias committed Oct 8, 2023
1 parent 784760e commit 1686fe7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/mesh/Router.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -316,15 +316,18 @@ bool perhapsDecode(meshtastic_MeshPacket *p)
config.device.rebroadcast_mode == meshtastic_Config_DeviceConfig_RebroadcastMode_ALL_SKIP_DECODING)
return false;

//if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag)
// return true; // If packet was already decoded just return

// assert(p->which_payloadVariant == MeshPacket_encrypted_tag);

// Try to find a channel that works with this hash
for (ChannelIndex chIndex = 0; chIndex < channels.getNumChannels(); chIndex++) {
// Try to use this hash/channel pair
if (channels.decryptForHash(chIndex, p->channel)) {
if (p->which_payload_variant == meshtastic_MeshPacket_decoded_tag) {
// packet is not encoded, just set channel and return
p->channel = chIndex;
return true;
}

// Try to decrypt the packet if we can
size_t rawSize = p->encrypted.size;
assert(rawSize <= sizeof(bytes));
Expand Down

0 comments on commit 1686fe7

Please sign in to comment.