Added packet_dupe_timeout conf

This patch adds the new packet_dump_timeout config option, defaulting to
60 seconds.   If the same packet matching the from, to, msgNo is RX'd
within that timeout the packet is considered a dupe and will be
dropped.  Ack packets are not subject to dupe checking.
This commit is contained in:
Hemna 2023-10-05 13:56:02 -04:00
parent 116f201394
commit f41488b48a
3 changed files with 9 additions and 2 deletions

View File

@ -281,7 +281,9 @@ class SendMessageNamespace(Namespace):
self.request = data
data["from"] = CONF.callsign
path = data.get("path", None)
if "," in path:
if not path:
path = []
elif "," in path:
path_opts = path.split(",")
path = [x.strip() for x in path_opts]
else:

View File

@ -65,6 +65,11 @@ aprsd_opts = [
"2 means 1 packet every 2 seconds allowed."
"5 means 1 pack packet every 5 seconds allowed",
),
cfg.IntOpt(
"packet_dupe_timeout",
default=60,
help="The number of seconds before a packet is not considered a duplicate.",
),
]
watch_list_opts = [

View File

@ -105,7 +105,7 @@ class APRSDPluginRXThread(APRSDRXThread):
# we send the 3 acks for the packet.
pkt_list.rx(packet)
self.packet_queue.put(packet)
elif packet.timestamp - found.timestamp < 60:
elif packet.timestamp - found.timestamp < CONF.packet_dupe_timeout:
# If the packet came in within 60 seconds of the
# Last time seeing the packet, then we drop it as a dupe.
LOG.warning(f"Packet {packet.from_call}:{packet.msgNo} already tracked, dropping.")