mirror of
https://github.com/meshcore-dev/MeshCore.git
synced 2026-10-28 16:13:32 +00:00
* workaround for edge case described here: https://github.com/meshcore-dev/MeshCore/pull/3630#issuecomment-6275517866
This commit is contained in:
1 parent
a8b3118b42
commit
5250eb7440
1 file changed
+10
@@ -107,6 +107,16 @@ DispatcherAction Mesh::onRecvPacket(Packet* pkt) {
|
||||
// RE-WRITE the mode bits, to indicate path was modified
|
||||
pkt->transport_codes[0] &= ~(3 << 14); // clear the hi 2 bits
|
||||
pkt->transport_codes[0] |= ((uint16_t)DM_MODE_SEQ_WIDE_MODIFIED) << 14;
|
||||
// WORKAROUND: edge case where _next_ hash in the path is THIS node!
|
||||
if (cursor + 1 < pkt->getPathHashCount()) {
|
||||
auto next_hash = curr_hash + hash_size;
|
||||
if (self_id.isHashMatch(next_hash, hash_size)) {
|
||||
pkt->setPathHashCount(pkt->getPathHashCount() - 1); // remove next_hash
|
||||
for (uint8_t k = cursor*hash_size; k < pkt->getPathHashCount()*hash_size; k += hash_size) { // shuffle path by 1 'entry'
|
||||
memcpy(&pkt->path[k], &pkt->path[k + hash_size], hash_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
is_match = false;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user