From 1f6c55d2bf125b08c1a56106241c24aa9116cea3 Mon Sep 17 00:00:00 2001 From: Hemna Date: Wed, 27 Sep 2023 14:55:47 -0400 Subject: [PATCH] Fix for dupe packets. Sometimes over KISS clients (RF), we can get duplicate packets due to having many digipeters in range of the TNC that aprsd is connected to. We will now filter out any dupe packets that aprsd is still in the process of doing it's 3 acks. --- ChangeLog | 1 + aprsd/packets/tracker.py | 11 +++++------ aprsd/threads/rx.py | 10 ++++++++-- 3 files changed, 14 insertions(+), 8 deletions(-) diff --git a/ChangeLog b/ChangeLog index 8ad4952..827ad9c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -4,6 +4,7 @@ CHANGES v3.2.0 ------ +* Update Changelog for 3.2.0 * minor cleanup prior to release * Webchat: fix input maxlength * WebChat: cleanup some console.logs diff --git a/aprsd/packets/tracker.py b/aprsd/packets/tracker.py index e62706a..ac5d4b4 100644 --- a/aprsd/packets/tracker.py +++ b/aprsd/packets/tracker.py @@ -72,18 +72,17 @@ class PacketTrack(objectstore.ObjectStoreMixin): @wrapt.synchronized(lock) def add(self, packet): - key = int(packet.msgNo) + key = packet.msgNo self.data[key] = packet self.total_tracked += 1 @wrapt.synchronized(lock) - def get(self, id): - if id in self.data: - return self.data[id] + def get(self, key): + if key in self.data: + return self.data[key] @wrapt.synchronized(lock) - def remove(self, id): - key = int(id) + def remove(self, key): if key in self.data.keys(): del self.data[key] diff --git a/aprsd/threads/rx.py b/aprsd/threads/rx.py index 8387d16..2ee125f 100644 --- a/aprsd/threads/rx.py +++ b/aprsd/threads/rx.py @@ -70,8 +70,14 @@ class APRSDPluginRXThread(APRSDRXThread): packet = self._client.decode_packet(*args, **kwargs) # LOG.debug(raw) packet.log(header="RX") - packets.PacketList().rx(packet) - self.packet_queue.put(packet) + tracked = packets.PacketTrack().get(packet.msgNo) + if not tracked: + # If we are in the process of already ack'ing + # a packet, we should drop the packet + # because it's a dupe within the time that + # we send the 3 acks for the packet. + packets.PacketList().rx(packet) + self.packet_queue.put(packet) class APRSDProcessPacketThread(APRSDThread):