From 72ba27d63c634e1f37ec74488e9bde02da436cd2 Mon Sep 17 00:00:00 2001 From: JRG Date: Fri, 14 Aug 2026 22:24:53 +0300 Subject: [PATCH] Link: fix resource cancellation Resource.cancel() -> Link.cancel_{incoming/outgoing}_resource() changes the iterated list and every second resource is skipped. Fix: iterate over copies of the two lists --- RNS/Link.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/RNS/Link.py b/RNS/Link.py index 41f6c9e3..f6d67723 100644 --- a/RNS/Link.py +++ b/RNS/Link.py @@ -683,8 +683,8 @@ class Link: except Exception as e: pass def link_closed(self): - for resource in self.incoming_resources: resource.cancel() - for resource in self.outgoing_resources: resource.cancel() + for resource in self.incoming_resources.copy(): resource.cancel() + for resource in self.outgoing_resources.copy(): resource.cancel() if self._channel: self._channel._shutdown() self.prv = None