Use canonical interface detach in auto-connected interface monitor job

This commit is contained in:
Mark Qvist 2026-09-29 14:52:49 +02:00
parent 135e941fa2
commit 26aec0040e
No known key found for this signature in database
2 changed files with 9 additions and 9 deletions

View file

@ -710,9 +710,9 @@ class InterfaceDiscovery():
RNS.log(f"Error while de-registering auto-connected interface from transport: {e}", RNS.LOG_ERROR)
def teardown_interface(self, interface):
interface.detach()
RNS.Transport.remove_interface(interface)
if interface in self.monitored_interfaces: self.monitored_interfaces.remove(interface)
was_detached = RNS.Reticulum.get_instance()._detach_interface(interface.name, internal_forced=True)
if was_detached and interface in self.monitored_interfaces: self.monitored_interfaces.remove(interface)
if not was_detached: RNS.log(f"Could not detach auto-connected interface {interface}", RNS.LOG_ERROR)
def autoconnect_count(self):
return len([i for i in RNS.Transport.interfaces if hasattr(i, "autoconnect_hash")])

View file

@ -763,8 +763,8 @@ class Reticulum:
RNS.log("System interfaces are ready", RNS.LOG_VERBOSE)
def _attach_interface(self, name):
if not Reticulum.__interface_management_enabled: return False
def _attach_interface(self, name, internal_forced=False):
if not internal_forced and not Reticulum.__interface_management_enabled: return False
try:
interfaces = { iface.name: iface for iface in RNS.Transport.interfaces }
if name in interfaces:
@ -791,8 +791,8 @@ class Reticulum:
except Exception as e: RNS.log(f"Error while detaching interface \"{name}\": {e}", RNS.LOG_ERROR)
return False
def _detach_interface(self, name):
if not Reticulum.__interface_management_enabled: return False
def _detach_interface(self, name, internal_forced=False):
if not internal_forced and not Reticulum.__interface_management_enabled: return False
try:
interfaces = { iface.name: iface for iface in RNS.Transport.interfaces }
if not name in interfaces:
@ -820,8 +820,8 @@ class Reticulum:
except Exception as e: RNS.log(f"Error while detaching interface \"{name}\": {e}", RNS.LOG_ERROR); RNS.trace_exception(e)
return False
def _reload_interface(self, name):
if not Reticulum.__interface_management_enabled: return False
def _reload_interface(self, name, internal_forced=False):
if not internal_forced and not Reticulum.__interface_management_enabled: return False
interfaces = { iface.name: iface for iface in RNS.Transport.interfaces }
if not name in interfaces:
RNS.log(f"Attempt to reload non-existing interface \"{name}\"", RNS.LOG_WARNING)