diff --git a/scapy/automaton.py b/scapy/automaton.py index 5f3ffcc12cd..f26370b102f 100644 --- a/scapy/automaton.py +++ b/scapy/automaton.py @@ -1042,9 +1042,10 @@ def _run() -> None: # start atmt atmt_server.runbg() # housekeeping - for atmt, clientsocket in clients: + for atmt, clientsocket in clients[:]: if not atmt.isrunning(): atmt.destroy() + clients.remove((atmt, clientsocket)) except KeyboardInterrupt: print("X Exiting.") ssock.shutdown(socket.SHUT_RDWR) diff --git a/test/scapy/automaton.uts b/test/scapy/automaton.uts index ab107b8bc74..6aec9b0bbac 100644 --- a/test/scapy/automaton.uts +++ b/test/scapy/automaton.uts @@ -519,4 +519,3 @@ if LINUX: if LINUX: # Remove the iptables rule assert os.system(IPTABLE_RULE % ('D', SECDEV_IP4)) == 0 -