Added option to configure blackhole update interval

This commit is contained in:
Mark Qvist
2026-05-28 17:12:21 +02:00
parent b4e15503c1
commit 0292465666
4 changed files with 23 additions and 8 deletions
+1 -1
View File
@@ -746,7 +746,7 @@ class BlackholeUpdater():
if identity_hash in self.last_updates: last_update = self.last_updates[identity_hash]
else: last_update = 0
if now > last_update+self.UPDATE_INTERVAL:
if now > last_update+RNS.Reticulum.blackhole_update_interval():
try:
destination_hash = RNS.Destination.hash_from_name_and_identity("rnstransport.info.blackhole", identity_hash)
RNS.log(f"Attempting blackhole list update from {RNS.prettyhexrep(identity_hash)}...", RNS.LOG_DEBUG)
+13 -6
View File
@@ -260,6 +260,7 @@ class Reticulum:
Reticulum.__autoconnect_discovered_interfaces = False
Reticulum.__required_discovery_value = None
Reticulum.__publish_blackhole = False
Reticulum.__blackhole_update_interval = RNS.Discovery.BlackholeUpdater.UPDATE_INTERVAL
Reticulum.__blackhole_sources = []
Reticulum.__interface_sources = []
Reticulum.__default_ar_target = None
@@ -452,12 +453,9 @@ class Reticulum:
value = self.config["logging"][option]
if option == "loglevel" and self.requested_loglevel == None:
RNS.loglevel = int(value)
if self.requested_verbosity != None:
RNS.loglevel += self.requested_verbosity
if RNS.loglevel < 0:
RNS.loglevel = 0
if RNS.loglevel > 7:
RNS.loglevel = 7
if self.requested_verbosity != None: RNS.loglevel += self.requested_verbosity
if RNS.loglevel < 0: RNS.loglevel = 0
if RNS.loglevel > 7: RNS.loglevel = 7
elif option == "logtimestamps":
value = self.config["logging"].as_bool(option)
RNS.logtimestamps = bool(value)
@@ -584,6 +582,11 @@ class Reticulum:
except Exception as e: raise ValueError(f"Invalid identity hash for remote blackhole source: {hexhash}")
if not source_identity_hash in Reticulum.__blackhole_sources: Reticulum.__blackhole_sources.append(source_identity_hash)
if option == "blackhole_update_interval":
v = self.config["reticulum"].as_float(option)
if v < 2: v = 2
Reticulum.__blackhole_update_interval = v*60
if option == "interface_discovery_sources":
v = self.config["reticulum"].as_list(option)
for hexhash in v:
@@ -1797,6 +1800,10 @@ class Reticulum:
"""
return Reticulum.__blackhole_sources
@staticmethod
def blackhole_update_interval():
return Reticulum.__blackhole_update_interval
@staticmethod
def discovered_interfaces():
"""
+5
View File
@@ -248,6 +248,11 @@ instance_name = default
# blackhole_sources = 521c87a83afb8f29e4455e77930b973b
# You can set the interval in minutes at which remote
# blackhole sources are updated. Defaults to one hour.
# blackhole_update_interval = 60
[logging]
# Valid log levels are 0 through 7: