def shutdown(self):
        ''' Close all active sockets; called when the session enters the 
            data collect state
        '''
        with self.servers_lock:
            while len(self.servers) > 0:
                (server, v) = self.servers.popitem()
                (host, port, sock) = v
                if sock is None:
                    continue
                if self.verbose:
                    self.session.info("closing connection with %s @ %s:%s" % \
                                      (server, host, port))
                sock.close()
        self.reset()
        self.dorecvloop = False
        if self.recvthread is not None:
            self.recvthread.join()
dataset/ETHPy150Open coreemu/core/daemon/core/broker.py/CoreBroker.shutdown/original