Transport: fix pending_links items removal while being iterated

master
JRG 2026-08-14 21:48:47 +03:00 committed by Mark Qvist
parent 0c41027765
commit 90ac62620d
1 changed files with 4 additions and 1 deletions

View File

@ -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 = []