def _shutdown_connection(connection): if not connection.rfile.closed: connection.socket.shutdown(socket.SHUT_RD)