From c2eac12ff55e78b4180777e13527d4e0c1a9642c Mon Sep 17 00:00:00 2001 From: Mark Qvist Date: Mon, 17 Aug 2026 20:47:30 +0200 Subject: [PATCH] Added burst count stat to interfaces --- RNS/Interfaces/BackboneInterface.py | 18 ++++++++++++++++++ RNS/Interfaces/Interface.py | 6 ++++++ 2 files changed, 24 insertions(+) diff --git a/RNS/Interfaces/BackboneInterface.py b/RNS/Interfaces/BackboneInterface.py index ccea86d7..19b593f9 100644 --- a/RNS/Interfaces/BackboneInterface.py +++ b/RNS/Interfaces/BackboneInterface.py @@ -170,6 +170,24 @@ class BackboneInterface(Interface): raise SystemError("Insufficient parameters to create listener") + __last_ic_burst_count_check = 0 + __last_ic_burst_count_state = 0 + @property + def ic_burst_count(self): + if time.time() > self.__last_ic_burst_count_check + 2: + self.__last_ic_burst_count_state = len([i.ic_burst_active for i in self.spawned_interfaces if i.ic_burst_active]) + + return self.__last_ic_burst_count_state + + __last_ic_pr_burst_count_check = 0 + __last_ic_pr_burst_count_state = 0 + @property + def ic_pr_burst_count(self): + if time.time() > self.__last_ic_pr_burst_count_check + 2: + self.__last_ic_pr_burst_count_state = len([i.ic_pr_burst_active for i in self.spawned_interfaces if i.ic_pr_burst_active]) + + return self.__last_ic_pr_burst_count_state + __last_ic_burst_check = 0 __last_ic_burst_state = False @property diff --git a/RNS/Interfaces/Interface.py b/RNS/Interfaces/Interface.py index 996ed8bc..b629d2e5 100755 --- a/RNS/Interfaces/Interface.py +++ b/RNS/Interfaces/Interface.py @@ -274,6 +274,12 @@ class Interface: if hasattr(self, "parent_interface") and self.parent_interface != None: self.parent_interface.sent_path_request(from_spawned=True) + @property + def ic_burst_count(self): return None + + @property + def ic_pr_burst_count(self): return None + def incoming_announce_frequency(self): n = len(self.ia_freq_deque) if not n > self.IC_DEQUE_MIN_SAMPLE: return 0