Don't remove items from a list we're iterating over

This commit is contained in:
Bob Lantz
2014-07-15 01:29:09 -07:00
parent 9a11544d87
commit 708b184397
+2 -2
View File
@@ -174,9 +174,9 @@ class Mininet( object ):
returns: True if all switches are connected"""
info( '*** Waiting for switches to connect\n' )
time = 0
remaining = copy.copy( self.switches )
remaining = list( self.switches )
while True:
for switch in remaining:
for switch in tuple( remaining ):
if switch.connected():
info( '%s ' % switch )
remaining.remove( switch )