From 90ac62620dd35b84249c2bc0006477cc727363aa Mon Sep 17 00:00:00 2001 From: JRG Date: Fri, 14 Aug 2026 21:48:47 +0300 Subject: [PATCH] Transport: fix pending_links items removal while being iterated --- RNS/Transport.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/RNS/Transport.py b/RNS/Transport.py index 6c2a4f44..ffb12586 100755 --- a/RNS/Transport.py +++ b/RNS/Transport.py @@ -532,6 +532,7 @@ class Transport: if time.time() > Transport.links_last_checked+Transport.links_check_interval: with Transport.pending_links_lock: + closed_pending_links = [] for link in Transport.pending_links: if link.status == RNS.Link.CLOSED: # If we are not a Transport Instance, finding a pending link @@ -555,7 +556,9 @@ class Transport: blocked_if = None path_requests[link.destination.hash] = blocked_if - Transport.pending_links.remove(link) + closed_pending_links.append(link) + + for closed_link in closed_pending_links: Transport.pending_links.remove(closed_link) with Transport.active_links_lock: closed_links = []