1
0
mirror of https://github.com/craigerl/aprsd.git synced 2024-12-18 23:55:58 -05:00

removed Packet.last_send_attempt and just use send_count

This commit is contained in:
Hemna 2024-04-15 10:00:35 -04:00
parent 1c9f25a3b3
commit 758ea432ed
4 changed files with 9 additions and 4 deletions

View File

@ -102,7 +102,6 @@ class Packet:
send_count: int = field(repr=False, default=0, compare=False, hash=False)
retry_count: int = field(repr=False, default=3, compare=False, hash=False)
last_send_time: float = field(repr=False, default=0, compare=False, hash=False)
last_send_attempt: int = field(repr=False, default=0, compare=False, hash=False)
# Do we allow this packet to be saved to send later?
allow_delay: bool = field(repr=False, default=True, compare=False, hash=False)

View File

@ -26,10 +26,16 @@ class SeenList(objectstore.ObjectStoreMixin):
cls._instance.data = {}
return cls._instance
@wrapt.synchronized(lock)
def stats(self, serializable=False):
"""Return the stats for the PacketTrack class."""
return self.data
@wrapt.synchronized(lock)
def copy(self):
"""Return a copy of the data."""
return self.data.copy()
@wrapt.synchronized(lock)
def update_seen(self, packet):
callsign = None

View File

@ -65,10 +65,9 @@ class PacketTrack(objectstore.ObjectStoreMixin):
pkts = {}
for key in self.data:
last_send_time = self.data[key].last_send_time
last_send_attempt = self.data[key]._last_send_attempt
pkts[key] = {
"last_send_time": last_send_time,
"last_send_attempt": last_send_attempt,
"send_count": self.data[key].send_count,
"retry_count": self.data[key].retry_count,
"message": self.data[key].raw,
}
@ -82,7 +81,7 @@ class PacketTrack(objectstore.ObjectStoreMixin):
@wrapt.synchronized(lock)
def add(self, packet):
key = packet.msgNo
packet._last_send_attempt = 0
packet.send_count = 0
self.data[key] = packet
self.total_tracked += 1

View File

@ -79,6 +79,7 @@ def _send_direct(packet, aprs_client=None):
packet_log.log(packet, tx=True)
try:
cl.send(packet)
packet.send_count += 1
except Exception as e:
LOG.error(f"Failed to send packet: {packet}")
LOG.error(e)