mirror of
https://github.com/craigerl/aprsd.git
synced 2024-11-25 09:28:38 -05:00
Compare commits
2 Commits
1a7694e7e2
...
5b2a59fae3
Author | SHA1 | Date | |
---|---|---|---|
5b2a59fae3 | |||
8392d6b8ef |
@ -110,6 +110,16 @@ aprsd_opts = [
|
|||||||
default=3,
|
default=3,
|
||||||
help="The number of times to send an ack packet in response to recieving a packet.",
|
help="The number of times to send an ack packet in response to recieving a packet.",
|
||||||
),
|
),
|
||||||
|
cfg.IntOpt(
|
||||||
|
"packet_list_maxlen",
|
||||||
|
default=100,
|
||||||
|
help="The maximum number of packets to store in the packet list.",
|
||||||
|
),
|
||||||
|
cfg.IntOpt(
|
||||||
|
"packet_list_stats_maxlen",
|
||||||
|
default=20,
|
||||||
|
help="The maximum number of packets to send in the stats dict for admin ui.",
|
||||||
|
),
|
||||||
]
|
]
|
||||||
|
|
||||||
watch_list_opts = [
|
watch_list_opts = [
|
||||||
|
@ -22,7 +22,7 @@ class PacketList(objectstore.ObjectStoreMixin):
|
|||||||
def __new__(cls, *args, **kwargs):
|
def __new__(cls, *args, **kwargs):
|
||||||
if cls._instance is None:
|
if cls._instance is None:
|
||||||
cls._instance = super().__new__(cls)
|
cls._instance = super().__new__(cls)
|
||||||
cls._maxlen = 100
|
cls._maxlen = CONF.packet_list_maxlen
|
||||||
cls.data = {
|
cls.data = {
|
||||||
"types": {},
|
"types": {},
|
||||||
"packets": OrderedDict(),
|
"packets": OrderedDict(),
|
||||||
@ -88,11 +88,22 @@ class PacketList(objectstore.ObjectStoreMixin):
|
|||||||
|
|
||||||
@wrapt.synchronized(lock)
|
@wrapt.synchronized(lock)
|
||||||
def stats(self, serializable=False) -> dict:
|
def stats(self, serializable=False) -> dict:
|
||||||
|
# limit the number of packets to return to 50
|
||||||
|
LOG.info(f"PacketList stats called len={len(self.data['packets'])}")
|
||||||
|
tmp = OrderedDict(reversed(list(self.data["packets"].items())))
|
||||||
|
pkts = []
|
||||||
|
count = 1
|
||||||
|
for packet in tmp:
|
||||||
|
pkts.append(tmp[packet])
|
||||||
|
count += 1
|
||||||
|
if count > CONF.packet_list_stats_maxlen:
|
||||||
|
break
|
||||||
|
|
||||||
stats = {
|
stats = {
|
||||||
"total_tracked": self._total_rx + self._total_rx,
|
"total_tracked": self._total_rx + self._total_rx,
|
||||||
"rx": self._total_rx,
|
"rx": self._total_rx,
|
||||||
"tx": self._total_tx,
|
"tx": self._total_tx,
|
||||||
"types": self.data["types"],
|
"types": self.data["types"],
|
||||||
"packets": self.data["packets"],
|
"packets": pkts,
|
||||||
}
|
}
|
||||||
return stats
|
return stats
|
||||||
|
@ -115,14 +115,11 @@ class APRSDDupeRXThread(APRSDRXThread):
|
|||||||
found = False
|
found = False
|
||||||
|
|
||||||
if not found:
|
if not found:
|
||||||
# If we are in the process of already ack'ing
|
# We haven't seen this packet before, so we process it.
|
||||||
# a packet, we should drop the packet
|
|
||||||
# because it's a dupe within the time that
|
|
||||||
# we send the 3 acks for the packet.
|
|
||||||
pkt_list.rx(packet)
|
pkt_list.rx(packet)
|
||||||
self.packet_queue.put(packet)
|
self.packet_queue.put(packet)
|
||||||
elif packet.timestamp - found.timestamp < CONF.packet_dupe_timeout:
|
elif packet.timestamp - found.timestamp < CONF.packet_dupe_timeout:
|
||||||
# If the packet came in within 60 seconds of the
|
# If the packet came in within N seconds of the
|
||||||
# Last time seeing the packet, then we drop it as a dupe.
|
# Last time seeing the packet, then we drop it as a dupe.
|
||||||
LOG.warning(f"Packet {packet.from_call}:{packet.msgNo} already tracked, dropping.")
|
LOG.warning(f"Packet {packet.from_call}:{packet.msgNo} already tracked, dropping.")
|
||||||
else:
|
else:
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
FROM python:3.11-slim as build
|
FROM python:3.11-slim as build
|
||||||
|
|
||||||
ARG VERSION=3.1.0
|
ARG VERSION=3.4.0
|
||||||
ENV TZ=${TZ:-US/Eastern}
|
ENV TZ=${TZ:-US/Eastern}
|
||||||
ENV LC_ALL=C.UTF-8
|
ENV LC_ALL=C.UTF-8
|
||||||
ENV LANG=C.UTF-8
|
ENV LANG=C.UTF-8
|
||||||
|
Loading…
Reference in New Issue
Block a user