mirror of https://github.com/craigerl/aprsd.git
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):
|
||||
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)
|
||||
def add(self, packet):
|
||||
key = packet.msgNo
|
||||
|
@ -78,13 +70,14 @@ class PacketTrack(objectstore.ObjectStoreMixin):
|
|||
|
||||
@wrapt.synchronized(lock)
|
||||
def get(self, key):
|
||||
if key in self.data:
|
||||
return self.data[key]
|
||||
return self.data.get(key, None)
|
||||
|
||||
@wrapt.synchronized(lock)
|
||||
def remove(self, key):
|
||||
if key in self.data.keys():
|
||||
try:
|
||||
del self.data[key]
|
||||
except KeyError:
|
||||
pass
|
||||
|
||||
def restart(self):
|
||||
"""Walk the list of messages and restart them if any."""
|
||||
|
|
|
@ -37,7 +37,7 @@ class PacketCounter:
|
|||
@property
|
||||
@wrapt.synchronized(lock)
|
||||
def value(self):
|
||||
return self.val.value
|
||||
return str(self.val.value)
|
||||
|
||||
@wrapt.synchronized(lock)
|
||||
def __repr__(self):
|
||||
|
|
Loading…
Reference in New Issue