def shutdown(self) -> None:
        """Close the TLS connection and the underlying network socket.
        """
        self._is_handshake_completed = False
        try:
            self._flush_ssl_engine()
        except IOError:
            # Ensure shutting down the connection never raises an exception
            pass

        try:
            self._ssl.shutdown()
        except OpenSSLError as e:
            # Ignore "uninitialized" exception
            if 'SSL_shutdown:uninitialized' not in str(e) and 'shutdown while in init' not in str(e):
                raise
        if self._sock:
            self._sock.close()
def shutdown ( self ) -> None : self . _is_handshake_completed = False try : self . _flush_ssl_engine ( ) except IOError : pass try : self . _ssl . shutdown ( ) except OpenSSLError as e : if 'SSL_shutdown:uninitialized' not in str ( e ) and 'shutdown while in init' not in str ( e ) : raise if self . _sock : self . _sock . close ( )
Close the TLS connection and the underlying network socket.