Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/Mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,7 +348,7 @@ DispatcherAction Mesh::onRecvPacket(Packet* pkt) {
break;
}
case PAYLOAD_TYPE_RAW_CUSTOM: {
if (pkt->isRouteDirect() && !_tables->hasSeen(pkt)) {
if (pkt->isRouteDirect() && !_tables->wasSeen(pkt)) {
_tables->markSeen(pkt);
onRawDataRecv(pkt);
//action = routeRecvPacket(pkt); don't flood route these (yet)
Expand Down Expand Up @@ -796,4 +796,4 @@ void Mesh::sendZeroHop(Packet* packet, uint16_t* transport_codes, uint32_t delay
sendPacket(packet, 0, delay_millis);
}

}
}
6 changes: 3 additions & 3 deletions src/helpers/SimpleMeshTables.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ class SimpleMeshTables : public mesh::MeshTables {
}
#endif

bool hasSeen(const mesh::Packet* packet) override {
bool wasSeen(const mesh::Packet* packet) override {
uint8_t hash[MAX_HASH_SIZE];
// ACK packets receive dedicated deduplication for three reasons:
//
Expand Down Expand Up @@ -73,7 +73,7 @@ class SimpleMeshTables : public mesh::MeshTables {
return false;
}

packet->calculatePacketHash(hash);
memcpy(hash, packet->calculatePacketHash(), sizeof(hash));

const uint8_t* sp = _hashes;
for (int i = 0; i < MAX_PACKET_HASHES; i++, sp += MAX_HASH_SIZE) {
Expand All @@ -94,7 +94,7 @@ class SimpleMeshTables : public mesh::MeshTables {

void markSeen(const mesh::Packet* packet) override {
uint8_t hash[MAX_HASH_SIZE];
packet->calculatePacketHash(hash);
memcpy(hash, packet->calculatePacketHash(), sizeof(hash));
memcpy(&_hashes[_next_idx * MAX_HASH_SIZE], hash, MAX_HASH_SIZE);
_next_idx = (_next_idx + 1) % MAX_PACKET_HASHES;
}
Expand Down