mirror of
https://github.com/craigerl/aprsd.git
synced 2025-08-04 06:22:25 -04:00
Fixed issue with packet tracker and msgNO Counter
The packet msgNo field is a string, but is typically is an integer counter to keep track of a specific packet id. The counter was returning an int, but the packet.msgNo is a string. So, when trying to delete a packet from the packet tracker, the key for accessing the packet is the msgNo, which has to be a string. Passing an int, will cause the packet tracker to not find the packet, and hence silently fail. This patch forces the msgNo counter to be a string.
This commit is contained in:
parent
f79b88ec1b
commit
9bdfd166fd
@ -62,14 +62,6 @@ class PacketTrack(objectstore.ObjectStoreMixin):
|
|||||||
def __len__(self):
|
def __len__(self):
|
||||||
return len(self.data)
|
return len(self.data)
|
||||||
|
|
||||||
@wrapt.synchronized(lock)
|
|
||||||
def __str__(self):
|
|
||||||
result = "{"
|
|
||||||
for key in self.data.keys():
|
|
||||||
result += f"{key}: {str(self.data[key])}, "
|
|
||||||
result += "}"
|
|
||||||
return result
|
|
||||||
|
|
||||||
@wrapt.synchronized(lock)
|
@wrapt.synchronized(lock)
|
||||||
def add(self, packet):
|
def add(self, packet):
|
||||||
key = packet.msgNo
|
key = packet.msgNo
|
||||||
@ -78,13 +70,14 @@ class PacketTrack(objectstore.ObjectStoreMixin):
|
|||||||
|
|
||||||
@wrapt.synchronized(lock)
|
@wrapt.synchronized(lock)
|
||||||
def get(self, key):
|
def get(self, key):
|
||||||
if key in self.data:
|
return self.data.get(key, None)
|
||||||
return self.data[key]
|
|
||||||
|
|
||||||
@wrapt.synchronized(lock)
|
@wrapt.synchronized(lock)
|
||||||
def remove(self, key):
|
def remove(self, key):
|
||||||
if key in self.data.keys():
|
try:
|
||||||
del self.data[key]
|
del self.data[key]
|
||||||
|
except KeyError:
|
||||||
|
pass
|
||||||
|
|
||||||
def restart(self):
|
def restart(self):
|
||||||
"""Walk the list of messages and restart them if any."""
|
"""Walk the list of messages and restart them if any."""
|
||||||
|
@ -37,7 +37,7 @@ class PacketCounter:
|
|||||||
@property
|
@property
|
||||||
@wrapt.synchronized(lock)
|
@wrapt.synchronized(lock)
|
||||||
def value(self):
|
def value(self):
|
||||||
return self.val.value
|
return str(self.val.value)
|
||||||
|
|
||||||
@wrapt.synchronized(lock)
|
@wrapt.synchronized(lock)
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user