def close(self) -> None:
        """
        Closes the transport and the background event loop as soon as possible.
        """
        def _shutdown() -> None:
            self.transport.close()
            self.shutdown_event.set()

        with self._shutdown_lock:
            if not self._shutdown:
                self._shutdown = True
                self.protocol.loop.call_soon_threadsafe(_shutdown)
def close ( self ) -> None : def _shutdown ( ) -> None : self . transport . close ( ) self . shutdown_event . set ( ) with self . _shutdown_lock : if not self . _shutdown : self . _shutdown = True self . protocol . loop . call_soon_threadsafe ( _shutdown )
Closes the transport and the background event loop as soon as possible.