Don't remove items from a list we're iterating over
This commit is contained in:
+2
-2
@@ -174,9 +174,9 @@ class Mininet( object ):
|
|||||||
returns: True if all switches are connected"""
|
returns: True if all switches are connected"""
|
||||||
info( '*** Waiting for switches to connect\n' )
|
info( '*** Waiting for switches to connect\n' )
|
||||||
time = 0
|
time = 0
|
||||||
remaining = copy.copy( self.switches )
|
remaining = list( self.switches )
|
||||||
while True:
|
while True:
|
||||||
for switch in remaining:
|
for switch in tuple( remaining ):
|
||||||
if switch.connected():
|
if switch.connected():
|
||||||
info( '%s ' % switch )
|
info( '%s ' % switch )
|
||||||
remaining.remove( switch )
|
remaining.remove( switch )
|
||||||
|
|||||||
Reference in New Issue
Block a user