Tear down active and pending links before interface detach
This commit is contained in:
parent
86004a89e5
commit
015692d51e
2 changed files with 16 additions and 10 deletions
|
|
@ -1319,11 +1319,11 @@ class Link:
|
||||||
|
|
||||||
def cancel_outgoing_resource(self, resource):
|
def cancel_outgoing_resource(self, resource):
|
||||||
if resource in self.outgoing_resources: self.outgoing_resources.remove(resource)
|
if resource in self.outgoing_resources: self.outgoing_resources.remove(resource)
|
||||||
else: RNS.log("Attempt to cancel a non-existing outgoing resource", RNS.LOG_ERROR)
|
else: RNS.log("Attempt to cancel a non-existing outgoing resource", RNS.LOG_WARNING)
|
||||||
|
|
||||||
def cancel_incoming_resource(self, resource):
|
def cancel_incoming_resource(self, resource):
|
||||||
if resource in self.incoming_resources: self.incoming_resources.remove(resource)
|
if resource in self.incoming_resources: self.incoming_resources.remove(resource)
|
||||||
else: RNS.log("Attempt to cancel a non-existing incoming resource", RNS.LOG_ERROR)
|
else: RNS.log("Attempt to cancel a non-existing incoming resource", RNS.LOG_WARNING)
|
||||||
|
|
||||||
def ready_for_new_resource(self):
|
def ready_for_new_resource(self):
|
||||||
if len(self.outgoing_resources) > 0: return False
|
if len(self.outgoing_resources) > 0: return False
|
||||||
|
|
|
||||||
|
|
@ -2998,25 +2998,31 @@ class Transport:
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def detach_interfaces():
|
def detach_interfaces():
|
||||||
|
with Transport.active_links_lock:
|
||||||
|
for link in Transport.active_links:
|
||||||
|
try: link.teardown()
|
||||||
|
except Exception as e: RNS.log(f"Could not tear down active link before interface detach: {e}", RNS.LOG_WARNING)
|
||||||
|
|
||||||
|
with Transport.pending_links_lock:
|
||||||
|
for link in Transport.pending_links:
|
||||||
|
try: link.teardown()
|
||||||
|
except Exception as e: RNS.log(f"Could not tear down pending link before interface detach: {e}", RNS.LOG_WARNING)
|
||||||
|
|
||||||
detachable_interfaces = []
|
detachable_interfaces = []
|
||||||
|
|
||||||
for interface in Transport.interfaces:
|
for interface in Transport.interfaces:
|
||||||
# Currently no rules are being applied
|
# Currently no rules are being applied
|
||||||
# here, and all interfaces will be sent
|
# here, and all interfaces will be sent
|
||||||
# the detach call on RNS teardown.
|
# the detach call on RNS teardown.
|
||||||
if not interface.detached:
|
if not interface.detached: detachable_interfaces.append(interface)
|
||||||
detachable_interfaces.append(interface)
|
else: pass
|
||||||
else:
|
|
||||||
pass
|
|
||||||
|
|
||||||
for interface in Transport.local_client_interfaces:
|
for interface in Transport.local_client_interfaces:
|
||||||
# Currently no rules are being applied
|
# Currently no rules are being applied
|
||||||
# here, and all interfaces will be sent
|
# here, and all interfaces will be sent
|
||||||
# the detach call on RNS teardown.
|
# the detach call on RNS teardown.
|
||||||
if not interface.detached:
|
if not interface.detached: detachable_interfaces.append(interface)
|
||||||
detachable_interfaces.append(interface)
|
else: pass
|
||||||
else:
|
|
||||||
pass
|
|
||||||
|
|
||||||
shared_instance_master = None
|
shared_instance_master = None
|
||||||
local_interfaces = []
|
local_interfaces = []
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue