mirror of
https://github.com/markqvist/Reticulum
synced 2026-11-22 23:10:32 +00:00
Use canonical interface detach in auto-connected interface monitor job
This commit is contained in:
2 files changed
+9
-9
No files matched your search
+3
-3
@@ -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")])
|
||||
|
||||
+6
-6
@@ -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)
|
||||
|
||||
Reference in new issue
Block a user