Revision 876e66e5 mininet/net.py

View differences:

mininet/net.py
91 91
import select
92 92
import signal
93 93
from time import sleep
94
from itertools import chain
94
from itertools import chain, groupby
95 95

  
96 96
from mininet.cli import CLI
97 97
from mininet.log import info, error, debug, output
......
408 408
            info( '*** Stopping %i terms\n' % len( self.terms ) )
409 409
            self.stopXterms()
410 410
        info( '*** Stopping %i switches\n' % len( self.switches ) )
411
        if self.switches:
412
            swclass = type( self.switches[ 0 ] )
411
        for swclass, switches in groupby( sorted( self.switches, key=type ), type ):
413 412
            if hasattr( swclass, 'batchShutdown' ):
414
                swclass.batchShutdown( self.switches )
413
                swclass.batchShutdown( switches )
415 414
        for switch in self.switches:
416 415
            info( switch.name + ' ' )
417 416
            switch.stop()

Also available in: Unified diff