Lock on stats for PacketList

This commit is contained in:
Hemna 2024-04-11 22:24:02 -04:00
parent 5ff62c9bdf
commit f59b65d13c
1 changed files with 4 additions and 4 deletions

View File

@ -84,13 +84,13 @@ class PacketList(objectstore.ObjectStoreMixin):
def total_tx(self):
return self._total_tx
@wrapt.synchronized(lock)
def stats(self, serializable=False) -> dict:
stats = {
"total_tracked": self.total_tx() + self.total_rx(),
"rx": self.total_rx(),
"tx": self.total_tx(),
"total_tracked": self._total_rx + self._total_rx,
"rx": self._total_rx,
"tx": self._total_tx,
"types": self.data["types"],
"packets": self.data["packets"],
}
return stats