diff --git a/tools/btconsole.py b/tools/btconsole.py index 711c81a..17ae82f 100644 --- a/tools/btconsole.py +++ b/tools/btconsole.py @@ -923,7 +923,8 @@ class Relay: for other_id in sorted(self.by_host): if other_id != host_id: self._send_control(conn, ROUTE_PEER_UP, other_id) - for other in self.by_host.values(): + for other in list(self.by_host.values()): # snapshot: a failed + # send drops that peer INSIDE the loop (mutates by_host) if other is not conn: self._send_control(other, ROUTE_PEER_UP, host_id) return @@ -990,7 +991,8 @@ class Relay: if conn.host_id is not None and self.by_host.get(conn.host_id) is conn: del self.by_host[conn.host_id] self.udp_endpoint.pop(conn.host_id, None) - for other in self.by_host.values(): + for other in list(self.by_host.values()): # snapshot: a failed + # send drops that peer INSIDE the loop (mutates by_host) self._send_control(other, ROUTE_PEER_DOWN, conn.host_id) self._maybe_reset_round()