(self)
Closes (terminates) the server and all of its clients. If applicable, 
        also unregisters from the registry server
Closes (terminates) the server and all of its clients. If applicable, 
        also unregisters from the registry server
Closes ( terminates ) the server and all of its clients . If applicable also unregisters from the registry server
def close(self):
        """Closes (terminates) the server and all of its clients. If applicable, 
        also unregisters from the registry server"""
        if self._closed:
            return
        self._closed = True
        self.active = False
        if self.auto_register:
            try:
                self.registrar.unregister(self.port)
            except Exception:
                self.logger.exception("error unregistering services")
        try:
            self.listener.shutdown(socket.SHUT_RDWR)
        except (EnvironmentError, socket.error):
            pass
        self.listener.close()
        self.logger.info("listener closed")
        for c in set(self.clients):
            try:
                c.shutdown(socket.SHUT_RDWR)
            except Exception:
                pass
            c.close()
        self.clients.clear()
def close ( self ) : if self . _closed : return self . _closed = True self . active = False if self . auto_register : try : self . registrar . unregister ( self . port ) except Exception : self . logger . exception ( "error unregistering services" ) try : self . listener . shutdown ( socket . SHUT_RDWR ) except ( EnvironmentError , socket . error ) : pass self . listener . close ( ) self . logger . info ( "listener closed" ) for c in set ( self . clients ) : try : c . shutdown ( socket . SHUT_RDWR ) except Exception : pass c . close ( ) self . clients . clear ( )